Textfield Max Length not respected when 'Number' is set as type

Axure 9.0.0.3675, as per the subject
Textfield Max Length not respected when ‘Number’ is set as type

This is actually correct behavior, per HTML5 spec: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input#attr-maxlength

That attribute is ignored for type as number. This behavior comes from the browser’s (correct) implementation of HTML5, not Axure.

You can sort of get around this by setting an OnTextChange case to set the text to [[this.text.substring(0,5)]] if the lenth of the text on the widget is greater than 5. However this won’t work if you use the spinner controls to go from 99999 to 100000.

Nice one, thanks for that!

Now that I think about it you could use a loop to always truncate the input to n digits if you really need. Something like:

OnLoad
Set text on this widget to: [[this.text.substring(0,n)]]
Wait 250ms
Fire Event OnLoad

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.