Expand my Community achievements bar.

SOLVED

Null Text Field, how to prompt to fill in another text field

Avatar

Former Community Member

I would like to be able to prompt the user to fill in either one of two text fields, If for example they fill in text field A, then no prompt would pop up, but if they didn't fill in text field A then a prompt would pop up asking them to fill in text field B.

Thanks

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

One way would be to place a JavaScript in the exit event of TextFieldA:

if (this.rawValue === null) {

     xfa.host.messageBox("Please complete Text Field B", "Attention", 0, 0);

}

However this will only fire when the user exits TextFieldA. You may need additional script if it is likely that the user does not even enter this text field.

Niall

View solution in original post

4 Replies

Avatar

Correct answer by
Level 10

Hi,

One way would be to place a JavaScript in the exit event of TextFieldA:

if (this.rawValue === null) {

     xfa.host.messageBox("Please complete Text Field B", "Attention", 0, 0);

}

However this will only fire when the user exits TextFieldA. You may need additional script if it is likely that the user does not even enter this text field.

Niall

Avatar

Former Community Member

Hi Niall,

Thanks for coming back to me, is there a script that would prompt the user

if they left a field blank without entering it.

Kind regards

Steve

Avatar

Level 10

Hi,

Yes, you would use the same script in the same object, but you would just need to decide when this would be fired.

For example, you might add the script to the prePrint event or the preSubmit event and see does this match the functionality you are looking for.

Does that help?

Niall