In this tutorial we'll cover how to display an Other Textbox in a Radio Button or Checkbox question only after the associated answer option has been clicked. Many users want their survey to be as clean as possible. Only showing an other field after being clicked can help your survey seem a little cleaner and a little less daunting.
Please note that this script is compatible with multiple 'other, write in' fields in the same question.
Check it out in an example survey.
OR
Add a survey with this setup to your account!
Setup
Go to the Style tab and scroll to the bottom of the survey preview to access the link to the HTML/CSS Editor. Paste the code below at the bottom of your HTML.
<script type="text/javascript">
$(function() {
var $otherLi = $('.sg-other-li');
$otherLi.find('.sg-other').hide();
$otherLi.parents('ul').find('li > input').change(function() {
$option_list = $(this).parents('ul');
$option_list.children('li.sg-other-li').each(function() {
if ($(this).children('input').is(':checked')) {
$(this).find('.sg-other').show();
} else {
$(this).find('.sg-other').hide();
}
})
})
});
</script>
Testing Time!
It's time to test your survey. Pull up your radio button question. You should only see your other option. Now click on the other option. Viola! Upon clicking you should see your other textbox pop up.
Considerations
This script works best if the associated question is on its own survey page. If a page reload is triggered (perhaps by an unanswered required question), the other text box will be hidden again and the respondent will be forced to re-select the answer option to show it.
Scripting and Other Custom Solutions
We’re always happy to help you debug any documented script that is used as is. That said, we do not have the resources to write scripts on demand or to debug a customized script.
If you have customization ideas that you haven't figured out how to tackle, we're happy to be a sounding board for SurveyGizmo features and functionality ideas that might meet your needs. Beyond this, check out our Professional Services; these folks have the scripting chops to help you to achieve what you are looking for!
— Mike.cordeiro on 08/27/2020
@Julie: Thank you for reaching out to our help page!
One can turn off question numbering via Style > Text > Text options and deselecting the question numbering option. Follow the documentation below for more information:
https://help.surveygizmo.com/help/turn-off-question-numbers
I hope this helps clarify.
Mike
Technical Writer
SurveyGizmo Learning and Development
— Julie on 08/25/2020
how do i hide the question numbers?
Admin
— Dave Domagalski on 01/10/2018
@Yehonatan: Thank you for exploring SurveyGizmo documentation content!
What you are looking to accomplish should be possible with the use of JavaScript. I'm afraid that at this time we do not have a ready-made example of this specific use-case.
You could consider posting your question to SurveyGizmo's Community forum to see if other users have implemented this type of solution and can share their code with you:
community.surveygizmo.com
Additionally, SurveyGizmo's Programming Services team is available to build customized survey solutions:
https://www.surveygizmo.com/programming-services/
I hope this helps clarify!
David
Documentation Specialist
SurveyGizmo Customer Experience
— Yehonatan on 01/10/2018
hey gizmo
is there a way to extend this workaround to hide / show several answer options?
I want to show by defualt the most popular options and allow the respondant to choose 'more' if he wants to see the rest of them
e.g:
what pet do you have?
1. dog
2. cat
3.fish
98. (show more)
99 no pet.
and if the respondant chooses (show more) then the question displays a larger list of answer options (without moving to a different question).
1. dog
2. cat
3.fish
4. cow
5. lizard
6. parrot
7.
8
9.
10..
11.
98. (show less).
99 no pet.
thanks!
Admin
— Bri Hillmer on 02/17/2016
@Rhys: Great question! I just tested this and it works for the Checkbox question as well!
Bri
Documentation Coordinator/Survey Sorceress
SurveyGizmo Customer Support
— Rhys on 02/16/2016
Is there any version of this for a Checkboxes question? Would like to show the Other Specify box when Other is selected, and hide it when not selected.