View Full Version : How to change textfield maxLength ( dynamically)

20 Mar 2012, 3:47 AM
Is it possible to change dynamically texfield's maxLegth !?!?!Thanks a lot

20 Mar 2012, 4:23 AM
You can manually modify a field's maxLength property at any time and it will be respected by the field validation rules. However, this does nothing to the physical length of the input field and doesn't stop a user from entering a longer value than desired; it only affects the validation rule on the field and causes it to turn red if too many characters are entered.

If you're also using enforceMaxLength, the enforcement of string length is actually set in DOM attributes when the component is rendered, so again, dynamically modifying the maxLength property won't have the desire effect.

20 Mar 2012, 7:22 AM
Try update textfield.inputEl.dom.maxLength
Demo here http://ext4all.com/post/how-to-dynamically-change-textfield-maxlength