Remove label in multiple choice question and only allow number entry | Experience Community
Skip to main content
Solved

Remove label in multiple choice question and only allow number entry

  • Feb 19, 2021 6:18 PM UTC
  • 5 replies
  • 499 views

Forum|alt.badge.img+1

Hello,
I have a multiple-choice question with 3 answer options. The first one is supposed to be just a text entry box but a) only numbers should be allowed to enter, and b) there should not be anything else but the textbox (so, no label of the answer option). Basically, I want a text entry box with numbers only allowed, and then 2 options with "don't know" and "refuse to answer".
Hope this makes sense and someone can help me.
Thanks a lot!

Best answer by ahmedA

Oh that! Let the text be anything. Add this to your JS:

this.getQuestionContainer().querySelector(".TextEntryBox").previousElementSibling.hide();

View original

5 replies

Forum|alt.badge.img+22
  • Level 7 ●●●●●●●
  • Feb 19, 2021 6:34 PM UTC

Make the text of option a to:

...

You can use validation to allow only numbers.


Forum|alt.badge.img+1
  • Author
  • Feb 19, 2021 7:59 PM UTC

https://www.qualtrics.com/community/discussion/comment/34751#Comment_34751Thanks for your answer but is there another way than just making the text transparent? It looks odd when taking the survey.
On the validation issue, it doesn't let me allow only numbers. In the custom validation option, it only lets me add an error message.


Forum|alt.badge.img+22
  • Level 7 ●●●●●●●
  • Feb 19, 2021 8:09 PM UTC

Change style to

"display:none"

Add this line to your JS:
this.getQuestionContainer().querySelector(".TextEntryBox").type = "Number";


Forum|alt.badge.img+1
  • Author
  • Feb 19, 2021 8:22 PM UTC

Like this? ...
It still leaves this grey box above the text entry
Screen Shot 2021-02-19 at 15.18.00.png
Thanks, the JS code for the number validation worked!


Forum|alt.badge.img+22
  • Level 7 ●●●●●●●
  • Answer
  • Feb 19, 2021 8:41 PM UTC

Oh that! Let the text be anything. Add this to your JS:

this.getQuestionContainer().querySelector(".TextEntryBox").previousElementSibling.hide();