I have a requirement to display a numeric sequence in a form of a specific lenght.
The sequence can start with leading zeros. The sequence can only be numeric. i.e 001234
If I use a numeric field to satisfy the second requirement, the numeric field strips out the leading zeros.
If I use a text field, then I can't control the user inputting alpha chars as well as numerics.
Any ideas ?
Discussion posts and replies are publicly visible
Hi pauls0003 ,
If you have a requirement to allow the user to enter a string of specific length with only numeric characters, you can try using the regex plugin function. See the below example will allow only numeric chars of length 10
a!textField(
label: "My number",
value: local!myNumber,
saveInto: local!myNumber,
validations: {
if(regexmatch("^[0-9]*$",local!myNumber), null,"Accepts only Numeric string"),
if(len(local!myNumber)<=10, null, "Accepts 10 or less than 10 characters")
}
)