Validation (regular expressions)
Each entry field in a form can be validated directly during entry with the help of a regular expression. Openforms supports Java regular expression to this end. In addition to the examples displayed below the website http://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html can be helpful.
Validation using the example of a textfield
- In the configuration area of a text box there is the possibility of selecting prefabricated regular expression from a dropdown menu.
- In the box to the right you may also formulate your own regular expressions.
- The Java Regex Syntax is to be followed
- Directly underneath the selection for the regular expression there is a dropdown for the selection of a special validation component. The special validation components are specific to certain projects and therefore not available in every openforms version. .
Here you may select from implemented more complex validations, e.g.:- EmailDNSValidation (the domain is verified)
- IBAN Validator (checksum of the IBAN is verified)
- Abbreviation (Validates whether names were for example entered in the form " Max A. Mustermann" )
Examples for Regular Expressions
Field | Validation and Explenation | Explenation |
---|---|---|
^[a-zA-Z0-9_.-]+@[a-zA-Z0-9_.-]+\.[a-zA-Z]{2,5}$ Das Symbol ^ bestimmt das die Eingabe vor dem @ mit den danach genannten zeichen erfolgen muss Das Symbol $ bedeutet das die Eingabe mit den vor $ genannten Zeichen enden muss | ||
Phone | [\+0][0-9 /\-]+ The signs / and + can be used once at most. All numbers can be used once or numerous times. | |
First Name | [a-zA-Z \-.,()+/?:'ÄäÖöÜüß]{1,35} All signs may be used with the exception of brackets. There has to be a minimum of one sign and a maximum of 35 signs. |