Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org

Feedback: irt.org FAQ Knowledge Base Q1047

Feedback on: irt.org FAQ Knowledge Base Q1047

Sent by Frank Mair on February 02, 2000 at 04:49:05: - feedback #784

Length:
Just right

Comments:
The above code is fine, but it is possible to do this check while the user is actually entering code and not afterwards!! See this page for more details:

http://www.developer.com/experts/javascripts/answer189.html


Sent by Sheldon Hart on September 24, 2001 at 12:42:46: - feedback #3188

Worth:
Very worth reading

Comments:
Thank you very much for providing this information!!

Prior to seeing this, I thought the only way to verify the length was after the user submitted the text. This would be very inconvenient and frustrating for them, losing all that they had typed.

As a newbie to this work, I really appreciate your kind and very worthwhile information!!!

Sheldon


Sent by Bill Wilkinson on October 01, 2002 at 18:43:29: - feedback #4183

Worth:
Worth reading

Length:
Too short

Technical:
Not technical enough

Comments:
The answer using onKeyUp is *BOGUS*! What happens if the user copy/pastes the text in using a mouse? Where does any onKeyUp even happen in that case?

This question misses the easiest answer of all that works on *ALL* browsers of which I am aware.

Just use a setTimeout to check the length of the text in the textarea every quarter second or so. Designer's choice as to whether it just chops the text to max size or pops up an alert.

Start the process at page load time and it works every time.

function checkTASize( )
{
var ta = document.FormName.TextAreaName;
if ( ta.value.length > 300 )
{
alert("Sorry...300 character limit");
ta.value = ta.value.substring(0,300);
}
setTimeout( "checkTASize()", 250 );
}
checkTASize( );





©2018 Martin Webb