How to validate the form field
Hi All, Good day
I have multiple forms and I have to validate the character limit used for the State field. It should allow only 2 character. If the character limit not set or if the character limit set more that 2 it should highlight the field.
Below is the script I am try to accomplish the above task. and it is not working properly.
var arr = ['Rep_state','clm_st','ee_st','ee_st2','patient_st','physician_state','wc_st','phys_st1','phys_st2']; //Filed names
for (var i = 0; i < this.numFields; i++) {
var A = this.getField(this.getNthFieldName(i));
if (arr.indexOf(A.name) >=0) {
if(A.name.charLimit != 2){
app.alert("Check the state character Limit") // Or it should highlight the field.
}
}
}
