Tip: Interface patterns give you an opportunity to explore different interface designs. Be sure to check out How to Adapt a Pattern for Your Application.
Enforce that the user enters at least a certain number of characters in their text field, and also enforce that it contains the "@" character.
This scenario demonstrates:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
a!localVariables(
local!varA,
a!formLayout(
label: "Example: Multiple Validation Rules on One Component",
contents:{
a!textField(
label: "Text",
instructions: "Enter at least 5 characters, and include the @ character",
value: local!varA,
saveInto: local!varA,
validations: {
if(len(local!varA)>=5, null, "Enter at least 5 characters"),
if(isnull(local!varA), null, if(find("@", local!varA)<>0, null, "You need an @ character!"))
}
)
},
buttons: a!buttonLayout(
primaryButtons: a!buttonWidget(
label: "Submit",
submit: true
)
)
)
)
Add Multiple Validation Rules to One Component