(Mobile) Number Input - edit minLength & maxLength fields

"(Mobile) Number Input - edit minLength & maxLength fields'
Is this possible?
I am trying to use a number input for a year field and it must be exactly 4 numbers long.

Hi @leviself56

This is interesting! On Mobile the Text Input component has a Validation rule for Min length and Max length as expected.

If you click view state of the Number Input, it shows maxLength and minLength values, but you can't add the Validation rule for it like you can in the Text Input.
State:


Validation options:

Maybe someone from Retool can help shed light on why that is?

An option in the meantime would be to create a Custom Validation rule that checks if the value of the Number Input is between set dates. Something similar to this should work:

{{self.value >= 1800 && self.value <3000 ? '' : "Please enter a 4-digit number."}}

You could also use a Text Input with the built in Min and Max lengths, and the create a Pattern rule with Regex requiring it to be only digits.

Thanks so much! The custom validation rule works perfect. Thanks for thinking outside the "box"