Expand my Community achievements bar.

SOLVED

Validation on core form components

Avatar

Level 3

Hi All,

 

I have used core form in my project and found that in out of the box core form text component there is no validation, I can able to put scripts as well in text and password fields. 

Can anyone suggest how can we enable the validation?

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Level 4

Hi, if you are able to write validation scripts for different fields in the form and the validation is not working then there might be an issue with your script (or) AEM might not be able to see your script.
In case, you think your script is right and you have used proper functions you can try with the following options:
1. add console and alert statements in the script and see if they are working
2. check the console in the browser for any js related errors
3. use the browser's inbuilt debugger to debug your js code

If AEM is not able to see your script, make sure you have put the js file at the right place. Use console and alert statements to make sure your script is working.

View solution in original post

3 Replies

Avatar

Correct answer by
Level 4

Hi, if you are able to write validation scripts for different fields in the form and the validation is not working then there might be an issue with your script (or) AEM might not be able to see your script.
In case, you think your script is right and you have used proper functions you can try with the following options:
1. add console and alert statements in the script and see if they are working
2. check the console in the browser for any js related errors
3. use the browser's inbuilt debugger to debug your js code

If AEM is not able to see your script, make sure you have put the js file at the right place. Use console and alert statements to make sure your script is working.

Avatar

Community Advisor

Hi @kanikaa32870678 

Here are the steps to enable validation for the text and password fields:

  1. Open the dialog of the Core Form component in AEM.
  2. Select the text or password field that you want to add validation to.
  3. In the properties of the field, go to the "Validation" tab.
  4. Enable the desired validation options such as "Required", "Minimum Length", "Maximum Length", etc.
  5. Configure the validation settings according to your requirements. For example, you can set a minimum and maximum length for the field, specify a regular expression pattern, or choose from predefined validation types.
  6. Save the changes to the dialog.

Once you have enabled the validation for the text or password field, AEM will automatically validate the input based on the configured validation settings. If the input does not meet the specified criteria, an error message will be displayed to the user.
https://experienceleague.adobe.com/docs/experience-manager-core-components/using/wcm-components/form...



Avatar

Administrator

@kanikaa32870678 Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.



Kautuk Sahni