Go Back   Trackpads Community > General Discussions > Computer and Technology > Web Design

Web Design Forums and discussions on webdesign

Web Design

Reply
 
LinkBack Thread Tools
Old 09-28-2005, 16:00   #1 (permalink)
Serg
Civilians

 
Default Can you add maxlength to a TEXTAREA field in a form

I mean let's face it, using just text you can, but it's an ugly one
line field.

And in textarea, it's all pretty, but there doesn't seem to be way to
limit the length.

What gives? And how could someone not design an inbetween?

Thanks

 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Trackpads Information
Click to Visit
Old 10-03-2005, 22:00   #2 (permalink)
Rob Meade
Civilians

 
Default Re: Can you add maxlength to a TEXTAREA field in a form

"Serg" wrote ...

>I mean let's face it, using just text you can, but it's an ugly one
> line field.
>
> And in textarea, it's all pretty, but there doesn't seem to be way to
> limit the length.
>
> What gives? And how could someone not design an inbetween?


For that Serg you would be requiring a little client side script - add a
javascript function that counts the characters that have been entered,
triggered by a text change or a keypress - when it getes to the magical
figure, prevent the user from entering anymore text and maybe display an
alert box to the screen to advise them...

Something like this could be good:


Put this in the HEAD tags of your page...

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin
function textCounter(field, countfield, maxlimit) {
if (field.value.length > maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
alert("parp!");
}
// End -->
</script>


Put within your FORM tags..

<textarea name="message" onKeyDown="textCounter(this.form.message,125);"
onKeyUp="textCounter(this.form.message,125);"></textarea>


Give it a go - hope it helps..

Rob


 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Syntax highlighting in a textarea Dylan Parry Web Design 2 10-27-2005 14:03
textarea rows Sig Web Design 6 10-23-2005 18:02
Weird Web Form problem - empty forms and blank from field Rocky Web Design 5 06-16-2005 08:00
Text Area form field/tab delimited text problems Brian Web Design 0 07-23-2004 15:09
Form field should start with certain characters Van Duijn Web Design 1 06-15-2004 18:32


Community Information
Options
Quick Options
Trackpads Non-Commercial Ad
Copyright Information Click to Visit
Time
Server Time
All times are GMT -4. The time now is 22:22.
Copyright
Copyright Information
The header is based off of work by Vipixel.com and modified by this site. Trackpads and the Trackpads Logo are both Registered Trademarks of Jason Edwards and cannot be used without prior written permission.  The only exception is as a link back to this site. Trackpads is a private website run by a small legion of volunteers, 3 dogs, 12.5 cats and an army of small, super smart, bio-engineered mice with pointy hats and tutu's. Search Engine Friendly URLs by vBSEO 3.2.0 RC7
Archive Links
Archive Links
Page generated in 0.71700 seconds with 19 queries