custom maximum length of an integer attribute

1
I need quick help. I have one integer attribute and set the custom maximum length to 8. but it is still accepting 10 digits.
asked
3 answers
4

Hi Iqbal,

It seems like the attribute length form field property only applies to String attributes. When defining attributes in the domain model, there is a length property for those that are of type String. Since only String attributes have this property, it only applies to them in forms.

If you want to limit the input of integers to a specific number of digits, you can, from the domain model, add a validation rule to the attribute restricting it to a number of characters. The user will still be able to put in any number of characters, but the form will not submit and they will see the validation error message below the form field. Additionally, you can also use custom validation via a custom save button to accomplish this.

answered
1

Hi 

We can achieve this with the help of a inputmask

 

answered
0

For anyone encountering this issue, integers can use custom validation by referencing the $value context in the expression. So, to limit an integer attribute to 8 digits, you would use an expression similar to: $value < 100000000 .  The validation message can be customized beneath the custom expression on the properties panel of the attribute; otherwise, it will be “This field is required”, which may not be helpful to users.

answered