Quick and dirty way of doing it could be to split(" ") the textarea
into an array and then get the length of the array ?


On Apr 7, 2005 5:13 PM, JRose <[EMAIL PROTECTED]> wrote:
> greetings list,
> 
> I need to count the words in a textarea and validate client side that it
> doesn't exceed a certain number.
> 
> We have been trying to use regular expressions to count the words.  Is
> there a way to count the words in a string and return the number of words
> to test against this value.  We would then trim out the extra words and
> send them back to the form.
> 
> We have it working using indexOf and only checking for spaces, but run into
> problems when there are tabs in the textarea.
> 
> thanks and kind regards,
> Jeffrey
> 
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support 
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:21:865
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/21
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:21
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.21
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to