max length on a number field



I have created a adaptive form with both text and number field (zipcode). maxlength works on the text but not on the number field.

When I set maximum characters in the field configuration, I am able to restrict the length on both the fields.

But because I need different character count for different countries on the zipcode, I cannot use the field configuration as it is setting the maximum for all countries.

I am using a rule editor and using the below configuration:

if (this.value == "US") {



}else if (this.value){





If anybody can help me how to set the maximum length on the number I will really appreciate it.



Accepted Solutions (1)

Accepted Solutions (1)



Hi Neil,

You can access the fields by name via JS on a form. For example, if your field is called 'country' then 'country.value' will contain the current value and 'this.value' will contain the value of the current field, so you shouldn't need to find them by id.

You may know this already but you can add a 'debugger;' statement into the form JS and step through it in inspector.

With regards to the actual problem you are trying to solve, I don't think you can change the maximum length/validation expression of the field programatically (setting validatePictureClause and maximum didn't work for me).

Unless anyone else replies and knows of a way to change the validation expression/maximum length, would having a few fields with different validation work?

That way you could show/hide them based on the logic you need - it would also have an advantage that you could easily vary the title as well. e.g. UK "Post Code"

P.S. if anyone from Adobe reads this - Is the guidebridge documentation for setProperty wrong?

Adaptive Forms Class: GuideBridge


I think it is missing two commas between the parameters and also the property looks to be called 'visible' as opposed to 'visibility' e.g:






Answers (0)