Validate the Length of an Entry in an Input Text Field

You can add code to an input field to validate the length of the text you enter in a form.

Suppose you have a form for creating a business object instance that has an input text field for capturing a numerical customer ID. You want to be sure that the number entered is between 3 and 7 characters. To do this, add this code to the input text field:
<oj-input-text id="oj-input-text--285061062-2" class="oj-flex-item oj-sm-12 oj-md-4" validators='[{  
    "type"           : "regExp", 
    "options"        : { 
    "pattern"        : "[a-zA-Z0-9]{3,7}", 
    "messageSummary" : "wrong length", 
    "messageDetail"  : "need 3-7 chars"}}]' >

Tip:

You can also add a field validator to the input text field to enforce the same rule. See Field Validators for Business Objects.

Any time you add validation for an input text field and want to customize the message displayed, simply add or edit the messageDetail attribute.