Revalidate on Server Functionality

James_R_Green

19-02-2018

Hi,

I have been looking the out of the box "Revalidate on Server" functionality on my adaptive form.

From testing, it looks like any validation that has been specified on individual fields with the rules editor (including functions in clientlibs) are re-executed.

Can anyone confirm the exact process that occurs when revalidating on the server please?

I would like to know if any checks are performed e.g on properties configured on the fields such as:

* Regular expressions (edit picture clause)

* Maximum length

* Minimum lengths

etc

Thanks,

James

Accepted Solutions (1)

Accepted Solutions (1)

jagjeetthukral

20-02-2018

Hi James R Green​,

When you enable server side validation, there is a server side hook which is enabled. When you submit the form, the form is sent to that hook, where all the Validate Rules (which are configured using widget options & validation rules in rule editor) that have been configured in the form are re-run.

You can think of it as form being previewed with the submitted data, on the server side, and the success being determined on the basis of .validate() function run at guideContainer level.

An important point to note here is that all the validation configured through rules should only be dependent on the scripts which are a part of the form (ie the client libraries should be a part of form's dependencies). So, if for example,  you have form being rendered on a page and you are using Page's java-script to validate the form, this won't work on server side.

If the validation passes, the data is sent to the submit action you have configured.

If the validation fails, the hook returns the form with to the browser again, showcasing the errors. An important point to note here is that all

Please let me know if you need more information.

Hope this helps !!!

Cheers,

Jagjeet Singh

AEM Forms Blog

Answers (3)

Answers (3)

jagjeetthukral

21-02-2018

Really Sorry for that.  I was rearranging the paragraphs to make better sense and it got jumbled.

What I wanted to write is :

If the validation fails, the hook returns the form with to the browser again, showcasing the errors. An important point to note here is that all the validation should be a part of Form's dependency scripts, and all other validations will not work.

Cheers,

Jagjeet Singh

AEM Forms Blog

James_R_Green

21-02-2018

jagjeetthukral

Thanks for that!

What were you going to see here, it looks important  but isn't finished:

"If the validation fails, the hook returns the form with to the browser again, showcasing the errors. An important point to note here is that all"