Expand my Community achievements bar.

numeric field validaion

Avatar

Former Community Member

Hi There,  I would like to perform a validation on a numeric field that is used to capture a telephone number.  I have selected num{9999999999} in the validate options and asked it to display an error message if the value is not equal to the 10 numbers or text.    I would like to know how I can get the field to delete the value in the numetic field once validation fails, as at this point it will return the error message and one can still  continue and fill in the rest of the fields and submit the form with the incorrect telephone number.  How can I go about this?  Joey

1 Reply

Avatar

Former Community Member

Hi Joe,

Try to write the following JavaScript on the "exit" event of the field:

var alength = this.rawValue.length;

if(alength<10)

{

this.rawValue="";

this.focus();

}

Please let me know in case of any issues.

Thanks,