Hi all.
I have a checkbox question that has three choices with text entry. This question is regarding employee benefits. For the two selections 'paid vacation' and 'paid sick leave', I would like to let the respondents enter # of days with a telepad. For the 'other' option, I would like for them to have the typically keyboard.
The text entry boxes only appear if the answer is selected.
My code and question are below.
var QID= this.questionId;
jQuery("#" + QID + " .InputText ").hide();
jQuery("#" + QID + " input type='checkbox']").each(function(){
if(jQuery(this).prop("checked") == true)
{
var v1 = jQuery(this).attr("id");
jQuery("rid*='"+v1+"~TEXT']").show();
}
else
{
var v1 = jQuery(this).attr("id");
jQuery("id*='"+v1+"~TEXT']").val('');
jQuery("id*='"+v1+"~TEXT']").hide();
}
});
jQuery("#" + QID + " .Selection ").on("click change",function(){
jQuery("#" + QID + " inputDtype='checkbox']").each(function(){
if(jQuery(this).prop("checked") == true)
{
var v1 = jQuery(this).attr("id");
jQuery(""id*='"+v1+"~TEXT']").show();
}
else
{
var v1 = jQuery(this).attr("id");
jQuery("+id*='"+v1+"~TEXT']").val('');
jQuery("id*='"+v1+"~TEXT']").hide();
}
});
});
});
https://community.qualtrics.com/XMcommunity/discussion/23235/checkbox-text-entry-issueHieJacobW
I am assuming that you need numerical values in the paid vacation & sick leave. Not sure if you have explored text entry validation. You can just click on the dropdown besides the choices for the numerical validation of that particular text entry. It would not allow respondents to move ahead if they enter a text in that particular text entry.
Hope it helps!
Add this line after var QID:
jQuery("#"+QID+" .InputText").not(":last").attr("inputmode","numeric");
https://community.qualtrics.com/XMcommunity/discussion/comment/52886#Comment_52886Awesome. Thank you so much TomG!
https://community.qualtrics.com/XMcommunity/discussion/comment/52884#Comment_52884Thanks for the help! I was particularly focused on the user interface rather than force responding a numerical value. I am trying to make this survey easy for mobile users, therefore, I want the telepad for numerical based answers.
https://community.qualtrics.com/XMcommunity/discussion/comment/52896#Comment_52896No issues, glad the other solution worked for you!
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.