validation not working

islandgirl23

12-10-2020

Hello,

I have a form which requires a phone number to be entered.  I created a text field to appear so that you can enter the phone number and I have a validation tied to the field so that it warns you to enter 10 digits which would display (000) 000-0000. The problem is that when I enter less than 10 digits, I get two warnings and whatever is in the block is entered into the form.  I want it to not do anything until 10 digits are entered.  Can anyone help?  FYI- I used "Action Builder" for the button to hide after a number is entered into the block because I could not figure out the script.  So this is how the button and field works.

After I enter the person's name, a text block with a button appears so that I can enter the phone number.  If I enter less than 10 digits, a warning box shows up and tells me to enter the phone number like 1111111111.  I click ok and another warning box shows up with the same information.  I click ok again, then whatever is currently in the block (less than 10 digits or any letter, etc.) is entered into the form and then the block disappears.  It doesn't allow me to fix the error prior to entering the phone number into the form.  

Accepted Solutions (1)

Accepted Solutions (1)

Kosta_Prokopiu1

Employee

13-10-2020

I would approach this as follows: I used the Phone Number - North America from the Custom library and adapted the formatting patterns as follows:

Display: text{'('999')' 999-9999}  Edit: text{9999999999}  Validation: text{9999999999}

In the exit event I add the lines :

if(this.rawValue.length > 0 && this.rawValue.length < 10) {
     xfa.host.setFocus(this.somExpression);
}

Which returns to the field while still wrong when you exit it with too little digits.

The sample is here: https://documentcloud.adobe.com/link/review?uri=urn:aaid:scds:US:65a89301-3c27-411d-a9f6-71c4b22b19d...

Your double messages probably come from explicit alerts or may have been incurred via the actionbuilder - I don't know your form, I can only guess.

Answers (0)