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 of field to always call JS function

Avatar

Avatar
Validate 25
Level 5
James_R_Green
Level 5

Likes

47 likes

Total Posts

191 posts

Correct Reply

47 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Boost 5
Boost 3
View profile

Avatar
Validate 25
Level 5
James_R_Green
Level 5

Likes

47 likes

Total Posts

191 posts

Correct Reply

47 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Boost 5
Boost 3
View profile
James_R_Green
Level 5

29-11-2018

Hi,

I want to store as much of the JS associated with my forms as possible in clientlibraries so that I can re-use and version control the code.

I can do this for the majority of tasks on the form using the guidebridge, but I don't have a satisfactory solution to the following.

Currently my validation works like this:

  • Each field I create has a call to "myvalidation.validateField(this);" added via the rules editor on the validate event
  • myvalidation.validate checks the this.name and applies the validation applicable to that field e.g. email, telephone etc

This works ....but I have to add a call to myvalidation.validate(this); to each field I create and the XML code that is stored on the form for the validation is unreadable.

Can this be done programatically so I don't have to configure this each time?

I tried on form load to gb.visit each field and overwrite the validateExp...but this 1) didn't work 2) is hacky

I could probably do something like call myvalidation.validate(this) when element focus changes and call it again on submit start or something, but I think this will then not be re-run by the "Enable serverside validation" option (which i need to use).

Any other way to do this?

Thanks,

Jim