/    Sign up×
Community /Pin to ProfileBookmark

textarea maxlength

it seems that maxlength=”” works for <input type=”text”> only.
is there anything that will do the same for <textarea>?

I am using php to error back messages longer than 1500 on my guestbook, but i assume it would be very annoying for people to have to delete what they have already written.

to post a comment
HTML

9 Comments(s)

Copy linkTweet thisAlerts:
@mcjimboDec 22.2004 — You will need to user javascript, unfortunately there is no standard html character limit solution. Here are a few examples you could deploy:

http://www.google.com/search?sourceid=navclient&ie=UTF-8&rls=GGLD,GGLD:2004-38,GGLD:en&q=textarea%2C+character+limit

James
Copy linkTweet thisAlerts:
@amazing_andr3authorDec 22.2004 — well at least i didn't write all the php for nothing. the javascript i found doesn't look too big, so i'm gonna use it. thanks.
Copy linkTweet thisAlerts:
@daimousDec 27.2004 — hey, try this one...

<textarea name="name" rows="num1" cols="num2"></textarea>

//Make sure that the product of num1 and num2 is equal to whatever

//maximum length you want...

-daimous
Copy linkTweet thisAlerts:
@amazing_andr3authorDec 27.2004 — rows and cols?

the standards say the user agent should provide ways of scrolling when the length exceeds what can be held by the textarea.

if you think about it, this makes sense.

anyways, try it for yourself, it's not gonna work.
Copy linkTweet thisAlerts:
@daimousDec 28.2004 — ?
Copy linkTweet thisAlerts:
@daimousDec 28.2004 — try this one for sure this will solve your problem nor answer your question...

?[URL=http://www.google.com.ph/search?hl=tl&q=working+with+textarea+HTML&meta=]Click Me[/URL]

-daimous
Copy linkTweet thisAlerts:
@PeOfEoDec 28.2004 — Javascript will not work... not alone. Keep in mind not all browsers support it. Check the length of the string server side before you put it in the db. If I wanted to I could just exploit your script and spam the heck out of you if you do this with java script because I can just go up to my toolbar and uncheck javascript.
Copy linkTweet thisAlerts:
@amazing_andr3authorDec 28.2004 — PeOfEo, that's a very good point.

What I decided in the end was to improve my PHP rather than use javascript.

What I'm doing is use PHP to reject comments shorter than 100 chars or longer than 1500 chars.

"I'm sorry but your post has 1600 characters and the limit is 1500"

Then I take the information he entered and put it back into an identical form.

So he is faced with the form as it was when he clicked submit. No need to click the back button (because the 'back button' on IE will erase anything entered into the textarea).

The fact that users are informed that there is a 1500 limit but they do not know the length of their input (until they submit) will actually encourage them to be as succinct as possible and use a length way below this limit 'just to be sure'.

Or at least that's my logic. I'll have to see this in action for a while to make sure I'm right.

oh BTW, don't you think it would be better to keep political statements for political forums? I strongly support palestinian demands for statehood, freedom and justice yet you don't see me posting any flags or making political statements.
Copy linkTweet thisAlerts:
@PeOfEoDec 28.2004 — Its is my custom user text feild and my avatar field. In it I chose to put some of my views. Nothing is stopping you from doing the same, as long as you do not put nudity or absenities in it. Also there is a fair ammount of political discussion that goes on in the coffee lounge forum.
×

Success!

Help @amazing_andr3 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...