msgbartop
News, views, tips and tricks on Oracle and other fun stuff
msgbarbottom

maxlength: Firefox vs. IE

I bumped into an issue while testing one of my ColdFusion applications. The issue is how Firefox and IE render HTML. Take the following HTML input tag in test.htm for example:

<input name="field" type="text" value="1234" maxlength="3">

Now, if you view it in Firefox (1.5.0.1) you will only see 123 in the input box. However, if you view it in IE (6.0) you will see 1234. Looks like Firefox truncates the value based on the maxlength attribute, but IE does not.

However, in the example above, both browsers do not allow you to enter a value more than 3 characters in length.


Filed in ColdFusion, Firefox, Tips on 07 Mar 06 | Tags: , ,


Reader's Comments

  1. |

    Presumably IE will truncate a default value that’s too long on submit, even though it doesn’t do it on load?

  2. |

    Using the example in the post above, if you submit from Firefox you will get form.field = 123.

    If you submit from IE you will get form.field = 1234.

    So, it looks like IE does not truncate at all.