This Javascript component can be used in conjunction with any text field widget (Input widget, Text area widget, ...).The goal of this component is making an Input widget follow the rules of a provided RegexPattern, in a very quick and easy-to-implement way.All the developer needs to do is provide the Id of the Text field widget that the component should be associated to, also providing a specific RegexPattern, in a string format, which will result in the respective Text field widget only allowing to type characters that MATCH that specific pattern.Alternatively, the developer can select from a pre-defined list of patterns, speeding up the development, since it will not be required to type the regex pattern itself, in this case.
IMPORTANT NOTES:- Both inputs of the component (RegexPattern and PreDefinedPattern) are non-mandatory
- If both are filled in, the specific RegexPattern typed by the user will have priority over the selected Pre-Defined pattern- Highly suggest to check the demo application, for an easy understanding of how the component works.
This component can be very useful in cases where there are specific business requirements concerning the characters allowed in a specific Text Field!!!
Added/Fixed copy-paste functionality
In the previous version, if the user tried to copy and paste numbers to an alphabetic regex field, he was able to, and that was wrong.
With this new version, the user will still be able to copy-paste, but only the characters that match the regex pattern will be pasted.