Hey there.
I am creating the following:
1. I have two check boxes - the user must select one of these (SSN or TIN)
2. I have a text field. The user enters 9 digits. The selection of the prior checkbox determines how to format this field.
I have the formatting working, as long as a selection is made. If none is made, no formatting occurs.
The problem I'm running into is as follows:
Assume the user does not select the check box but fills in 9 digits. I would like a message (app.alert) to appear instructing the user to select a checkbox value (of course, a more specific message).
However, no matter what I check for, it seems that it requires the user to tab or at least try to enter one more digit than the charLimit. For example, I tried to test willCommit as well as event.value.length == event.charLimit. But, this only occurs when the user tries to type one MORE character than the limit.
And when I try to add other code like this, I can get the "Error" message to appear, but only prior to the 9th digit appearing.
I would like for the 9 digits to appear, and upon entering that 9th digit, after it appears in the form, the app.alert appears if the check box is not selected.
Help! (I hope I'm specific enough).
Again, I have used this forum to figure out how to format the SSN and to autotab- the problem here is responding to max characters reached, user should NOT have to enter another digit or tab, checkbox not selected and a message should appear.
The next field is "ID Number". This has max limit of 9 characters.
As long as either T or S are selected, this formats properly and we move onto the next field in the form.
(Although it doesn't seem to format until I tab -- which poses the first problem. How can you determine you're at max after entering the 9th digit, having it format if either T or S are selected, and auto tab to the next field?). And yes, there are various scripts out there for auto tabbing and SSN/EIN - however, none of them are triggered by values in check boxes).
However, if the user enters 9 digits, but does not check the check box, the 9 digits should remain (set event.value), but I want a message to pop up AFTER the 9th digit appears in the text field.
In addition, if I change the value from S to T or vice-versa, I need the SSN number, if entered, to also change to the proper format. If i'm right, to do this, you cannot use "event" for the number, since you would be on the check box and the event would be the check box (thus requiring this.getField for the ID Number itself).