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

How to count or limit the number of words in a text box?

Participant ,
Mar 30, 2021 Mar 30, 2021

Copy link to clipboard

Copied

Hello everyone,

 

I want to create a textbox that will be filled everytime the user writes an answer.

The first option of make this text box to accept only the total number of words that fit the answer. After that, the keyboard will not responde anymore.

Another alternative (I think this is more advanced) would be to track each of the letters

the user inputs and in case it is a wrong one, the keyboard will not respond, until the right

choice of letters is made.

Can you please guide me towards achieving this goal? I would appreciate receiving your kind instructions/tips on that.

TOPICS
Create PDFs , How to , JavaScript , PDF forms

Views

3.7K

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

correct answers 2 Correct answers

Community Expert , Apr 01, 2021 Apr 01, 2021

In that case this should work for you, you will see how to change word on your own:

if(event.change) {
if(event.value == "")
event.rc = /^[l]+$/.test(event.change);
else if(event.value == "l")
event.rc = /^[e]+$/.test(event.change);
else if(event.value == "le")
event.rc = /^[t]+$/.test(event.change);
else if(event.value == "let")
event.rc = /^[t]+$/.test(event.change);
else if(event.value == "lett")
event.rc = /^[u]+$/.test(event.change);
else if(event.value == "lettu")
event.rc = /^[c]+$/.test(event.change)

...

Votes

Translate

Translate
Participant , Apr 05, 2021 Apr 05, 2021

I decided to use three radio buttons, since the idea is to lay out all the options at once.

Votes

Translate

Translate
Participant ,
Apr 05, 2021 Apr 05, 2021

Copy link to clipboard

Copied

I decided to use three radio buttons, since the idea is to lay out all the options at once.

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
Community Expert ,
Apr 05, 2021 Apr 05, 2021

Copy link to clipboard

Copied

LATEST

Good idea! Thank you for sharing that solution.

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