Forum Moderators: phranque

Message Too Old, No Replies

Advice on forms

How to limit size of inputed data.

         

mack

10:35 pm on Oct 20, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



On a simple web form. How would I limit the number of charictors allowed.

Thanks in advance.

Mack.

choster

10:43 pm on Oct 20, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



<input maxlength="max # of chars." ... >

There's no maxlength available for <textarea> however, so you'd have to use Javascript (some sort of test on document.Form.Textarea.value.length ).

mack

10:57 pm on Oct 20, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



<form method="POST" action="whatever.cgi">
<p><input type="text" maxlength="100" name="foo" size="30"></p>
<p><input type="submit" value="Submit" name="go"></p>
</form>

I tried your idea, works great, thanks very much.

Mack.