How to cusomize validations on submit action in Adaptive Form

Balu_M

29-11-2016

Hi , 

i have a requirement customize default error validation on Adaptive Form filed.

Problem: We have written custom validation method for email filed with onblur() event, but if user click on Submit method then my form is submitting with out calling my custom function.

I want to enable this call when user click on submit button, so that i can verify user data.

Can anyone guide me how to achieve this.

Accepted Solutions (0)

Answers (4)

Answers (4)

gauravahuja11

07-12-2016

Hi,

By using the rule editor, the validation script can be added for individual components as well. You can open the rule editor for the component on which you want to apply the script, or you can also select the required component from the form model tree available in the rule editor. When the submit button is clicked, it runs the validations on every component. If you've written a custom validation script, then that script will also get called.

sixteenlabsinc

29-11-2016

If you'd like to create a library of JavaScript files (and CSS) that apply to your forms then Client Libraries are the best approach. It's likely one of the most powerful features that you inherit when upgrading to AEM Forms from LiveCycle.

https://docs.adobe.com/docs/en/aem/6-2/develop/the-basics/clientlibs.html

Client Libs can be added to any number of forms and allow you to create standard libraries of features and functionality across your forms. Things like email, web, phone number validations can be added using the rule editor to make a call to your standard functions. 

Balu_M

29-11-2016

Hi Varundua,

If i opt for rule editor its form Level and i can not re-use the validation, I would like to apply validations at component level. So that author can configure it.

Is there possibility for component level validations?

varundua

29-11-2016

Hi
 

You can write the validation script on the validation event. If you are on 6.2 or 6.1 FP1 you can use the Rule Editor to add your validation logic using the Visual Editor

For more advance use case you can specify that using code editor where you can write any custom JavaScript 

For more information on rule editor please visit [1]

[1] https://helpx.adobe.com/aem-forms/6-1/rule-editor.html