• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Validate Word Count in Text Field

Guest
Jan 31, 2007 Jan 31, 2007

Copy link to clipboard

Copied

Hi. I need a method to validate the number of words in a text field. For example: A user has an option to chose the number of words they want to display. I need to pass this variable on, and use it to restrict them to the number of words they originally selected. So, if they picked 14 words, the the field where they enter the words won't let them go over 14 (and will tell them if they're a few words short).

Thanks for your help.
TOPICS
Advanced techniques

Views

511

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jan 31, 2007 Jan 31, 2007

Copy link to clipboard

Copied

Here is a link to a Javascript that does this. You would just need to modify it for your needs ie autodetect the number of words.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 31, 2007 Jan 31, 2007

Copy link to clipboard

Copied

For the server-side, you can use listLen() with space as the delimiter as a crude way to confirm.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jan 31, 2007 Jan 31, 2007

Copy link to clipboard

Copied

LATEST

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation