Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session
SOLVED

Revalidate on Server Functionality

Avatar

Level 7

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

1 Accepted Solution

Avatar

Correct answer by
Level 3

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

View solution in original post

4 Replies

Avatar

Correct answer by
Level 3

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

Avatar

Level 7

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"

Avatar

Level 3

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