text area word count

13 years 10 months ago #136529 by kenmcmahon
text area word count was created by kenmcmahon
Can anyone suggest a (simple) way to implement a word limit on a text area? I know there's a character limit option but, when exceeded it displays a not very user-friendly alert box. For my members (and, I would guess, most people) word counts make more sense than character counts.
Thanks
Ken

Please Log in to join the conversation.

13 years 10 months ago #136546 by krileon
Replied by krileon on topic Re:text area word count
I believe this can be done with REGEX validation. Please edit your field and for the parameter Authorized input: select Custom PERL regular expression. You could then try the following for Perl Regular Expression:.

[code:1]
/^(?:\b\w+\b\s*){0,250}$/
[/code:1]

For example the above will match between 0 and 250 words. Simply adjust 250 to whatever maximum you wish. This regex may need modification to meet your needs. If not knowledged in regex usage I recommend reviewing the tutorials found here .


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

13 years 10 months ago #136566 by kenmcmahon
Replied by kenmcmahon on topic Re:text area word count
Thanks Kyle. I'll take a look at those tutorials and give it a try.

Ken

Please Log in to join the conversation.

13 years 5 months ago #145028 by kenmcmahon
Replied by kenmcmahon on topic Re:text area word count
Bit of a late come back, but the problem with this is that like the max length parameter, it doesn't affect anything until the form is submitted. Not very user friendly. i need something that prevents entry of more than a given number of words on the form.

Please Log in to join the conversation.

13 years 5 months ago #145089 by krileon
Replied by krileon on topic Re:text area word count
Sorry, CB doesn't append a length to the input it self. It's fields validation so it does not validate until the form is submitted.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.201 seconds

Facebook Twitter LinkedIn