Various data types now include the possibility to define validation requirements for when content is entered in the resulting fragment:
Single line text
Compare against a predefined regex.
Check for specific values.
But while creating content fragment model and using single line text property or number property could not see option to provide validation regex. We are using AEM 126.96.36.199. Let me know how same can be added on fields.
In the past, I have created a client library that would inject HTML5 input pattern attribute in regex to each form field. Once the pattern field has been added into the input field, the disabled vs enabled submit button will automatically work as expected & also a red error box is shown (look at the screenshot in the bottom of the page). Before creating your own client library, you should go directly to the /dam/my-site/content-fragment's edit page (NOT THE content fragment template), and then paste this line of code in your developer's console. $('input[name=myinputfield]').attr("pattern", 'working|works').... make sure you change the name=myinputfield to your own input fields name. Once when you know how it works, you can proceed with the steps below.
Create a new client library (categories should be: dam.cfm.authoring.v2)