Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Validation Script Message

Avatar

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

Avatar

Avatar
Validate 1
Level 9
Steve_L_Walker
Level 9

Likes

197 likes

Total Posts

1,435 posts

Correct Reply

212 solutions
Top badges earned
Validate 1
Boost 50
Boost 5
Boost 3
Boost 25
View profile

Avatar
Validate 1
Level 9
Steve_L_Walker
Level 9

Likes

197 likes

Total Posts

1,435 posts

Correct Reply

212 solutions
Top badges earned
Validate 1
Boost 50
Boost 5
Boost 3
Boost 25
View profile
Steve_L_Walker
Level 9

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

Avatar

Avatar
Validate 1
Level 1
rose_premo
Level 1

Like

1 like

Total Posts

31 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile

Avatar
Validate 1
Level 1
rose_premo
Level 1

Like

1 like

Total Posts

31 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile
rose_premo
Level 1

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!!