Forum Moderators: open

Message Too Old, No Replies

Browsers ignoring "maxsize" attribute of input tag

         

techiejp

11:25 pm on Nov 25, 2001 (gmt 0)



I'm finding a growing number of errors coming in from our server because some browser is explicitly ignoring the maxlength attribute and it violates a constraint on the database. Can someone give me an idea what browser does this and if there's a way around it? Thanks.

Key_Master

11:40 pm on Nov 25, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Don't know about the browser part of it but if the script is written in Perl you can add the following:

if (length($form_data) > 100) {
$form_data = substr($form_data,0,100); # Shortens the string to 100 characters.
}

Of course, replace $form_data with the proper variable from your script.

tedster

11:45 pm on Nov 25, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I recently noticed Netscape 4.77 ignoring maxsize while running on Windows 98 -- what a bummer, that is not some obscure browser!

techiejp

12:54 am on Nov 26, 2001 (gmt 0)



Key_Master - Althougth I wouldn't want to cut parts of data off (makes for a very messy database), you have given me an alternative which might be useful. I hate having to make twice the work for myself making server side error catching. But, it would appear there isn't a better solution with the way browsers are going these days.

Key_Master

1:09 am on Nov 26, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You could try using length() to catch the variables that are exceeding the maximum size and then return them back to properly fill in the form data.

if (length($form_data) > 100) {
Some action to redirect the visitor's browser back to resubmit the form field here
}