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

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

Participant ,
Mar 30, 2021 Mar 30, 2021

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
6.6K
Translate
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
2 ACCEPTED SOLUTIONS
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);
else if(event.value == "lettuc")
event.rc = /^[e]+$/.test(event.change);
else event.rc = false;}

View solution in original post

Translate
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
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.

View solution in original post

Translate
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
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.

Translate
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
LATEST

Good idea! Thank you for sharing that solution.

Translate
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