Highlighted

Validation Script Message

Avatar

Guest

12-02-2009

Is it possible to have the Caption of a field to be referenced in the Validation Script Message?



Or



The focus to be put back on the field?

Replies

Highlighted

Steve_L_Walker

13-02-2009

Be cautious using focus on validation. It is very easy to create a closed loop.



For your validation message, you can set the validationMessage to the caption in the initialize event as follows:



this.validationMessage = this.resolveNode("caption.value.#text").value + " is invalid.";



Suppose you have a numeric field "qty", the Caption is set to Quantity", and the JavaScript validation event is "this.rawValue > 10;", if validation fails the message will be "Quantity is invalid.".



Steve
Highlighted

rose_premo

04-05-2010

I'm looking for something similar.

When the user submits the form, I want to run through and verify all the required fields are filled in, and then have a message box pop up saying "Please enter the following required information: *caption of missing field*"

I'm not sure how to manipulate the code in your answer to do this.

Thanks for your help!!