cancel
Showing results for 
Search instead for 
Did you mean: 

How to set a dynamic validation message in javascript

Sandra_Rossi
Active Contributor
0 Kudos

Hi,

I am using the "validate" event on a field, along with the "script message" field, to make a validation and send a message to the user if the test fails.

- Is it possible to define parameters in this message, for example "field &1 is invalid" where we replace &1 by the name of a field?

- Is it possible to send 2 different messages (I guess it's like using a message &1)?

- What is the best practice according to your experience?

Notes:

- I am aware of the xfa.host.messageBox, but I'd like to keep Adobe logic for validations (am I wrong? why?)

- I also saw the possibility of binding a field from the context, to the message field, but I found that it was not very clean to do this way (if even possible)

Thx !

Accepted Solutions (1)

Accepted Solutions (1)

Sandra_Rossi
Active Contributor
0 Kudos

According to the tests I did since yesterday, it is very difficult to use the "validation script message" (in the "value" tab of a "text input" field, within a dynamic table), for sending a dynamic message.

I abandon, and prefer to use use

xfa.host.messageBox( "dynamic message text" )

For information, I could change the message during "validate" event, with a rather complex algorithm.

Unfortunately, when a table row is just added (dynamically, with a button), though the message has been changed, it displays the original value. When I change the field again, the changed validation message is taken into account. I don't know why.

Edited by: Sandra Rossi on Jul 24, 2009 9:01 AM : it's only to say that since then, this was the only solution! Question closed

Answers (0)