Are you tied to doing this real time? As in by keystroke? I would think you 
could do this with the validator framework in almost real time (well ok at 
submit)

Al


-----Original Message-----
From: Paul McCulloch [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, April 20, 2005 11:21 AM
To: 'Struts Users Mailing List'
Subject: RE: html:text area

Watch out for users pasting in text that exceeds the allowed limit!

Paul

> -----Original Message-----
> From: Mike Darretta [mailto:[EMAIL PROTECTED]
> Sent: 2005/20/04 17:03
> To: Struts Users Mailing List
> Subject: Re: html:text area
> 
> 
> I had the same issue, and resolved it by executing a simple 
> javascript 
> upon each keystroke. If the user exceeded the max, the 
> keystroke would 
> be rejected (that is, no more text could be entered without deleting 
> previous text)....
> 
> In my JSP...
> <html:textarea name="MyForm" property="myProperty" rows="15"
>                                        onkeydown="return 
> checkSizeAgainstMax(this, value, 65536)"
>                                    style="width:100%"/>
> 
> My javascript....
> function checkSizeAgainstMax(textArea, str, maxLen) {
>     if (str.length >= maxLen) {
>         textArea.value = textArea.value.substring(0, maxLen);
>     }
> }
> 
> Mike
> 
> 
> Srilatha Salla wrote:
> 
> >Hi,
> >Can we restrict the length of textarea with any of the attributes?
> >I have textarea that should not accept more than 250 
> characters, so I want to know if I can restrict the length 
> with textarea attibutes.
> > 
> >Thanks.
> >
> >__________________________________________________
> >Do You Yahoo!?
> >Tired of spam?  Yahoo! Mail has the best spam protection around 
> >http://mail.yahoo.com 
> >  
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

Axios Email Confidentiality Footer
Privileged/Confidential Information may be contained in this message. If you 
are not the addressee indicated in this message (or responsible for delivery of 
the message to such person), you may not copy or deliver this message to 
anyone. In such case, you should destroy this message, and notify us 
immediately. If you or your employer does not consent to Internet email 
messages of this kind, please advise us immediately. Opinions, conclusions and 
other information expressed in this message are not given or endorsed by my 
Company or employer unless otherwise indicated by an authorised representative 
independent of this message.
 
WARNING:
While Axios Systems Ltd takes steps to prevent computer viruses from being 
transmitted via electronic mail attachments we cannot guarantee that 
attachments do not contain computer virus code.  You are therefore strongly 
advised to undertake anti virus checks prior to accessing the attachment to 
this electronic mail.  Axios Systems Ltd grants no warranties regarding 
performance use or quality of any attachment and undertakes no liability for 
loss or damage howsoever caused.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to