stringvalidator.lzx
<library>
<include href="basevalidator.lzx"/>
<class name="stringvalidator" extends="basevalidator">
<attribute name="maxLength" type="number" value="255
"/>
<attribute name="minLength" type="number" value="0
"/>
<attribute name="trim" type="boolean" value="false
"/>
<attribute name="minErrorstring" type="string" value="this string is shorter than the minimum allowed length.
"/>
<attribute name="maxErrorstring" type="string" value="this string is longer than the maximum allowed length.
"/>
<method name="doValidation" args="val">
var valtext = getValueText(val);
var textlength = valtext.length;
if(this.required && textlength < 1){
this.setErrorstring(this.requiredErrorstring);
return false;
}
if(valtext != ""){
if(textlength < minLength){
this.setErrorstring(this.minErrorstring);
return false;
}
if(maxLength < textlength){
this.setErrorstring(this.maxErrorstring);
return false;
}
}
this.setErrorstring("");
return true;
</method>
</class>
</library>
Cross References
Includes
Classes