I have a Checkbox with 5 total options, but 2 of them, if checked, need a text box to provide additional information. You can add 1 of this style checkbox using the "Other" option of the Checkbox configuration, but how would you add 2 "Other" style checkboxes to the same checkbox field?
Question
Question
Answer
SELECTED ANSWER
replied on October 8, 2018
•
Show version history
<EDITED to add singleline cf-large class >
Hi Bert,
You could tinker around with this:
$(".choices").change(function () {
if ($("input[id^=Field36-2]").is(':checked')) {
$("input[id^=Field36-2]").next("label").after(" " + "<input id='acomment' placeholder='Enter comments' type='text' />");
$("#acomment").addClass("singleline cf-large");
} else {
$("#acomment").remove();
}
});
1
0
replied on October 15, 2018
Thank you Andrew
You pointed me in the right direction and below is the JavaScript that I ended up using
$(document).ready(function () {
$("input[id^=Field13-3]").next("label").after(" " + "<input id='acolor' type='text' />");
$("#acolor").addClass("singleline cf-small");
$("#acolor").attr("readonly",true);
$(".appearancechoice").change(function () {
if ($("input[id^=Field13-3]").is(':checked')) {
$("#acolor").attr("readonly",false);
} else {
$("#acolor").attr("readonly",true);
}
});
});
1
0
Replies
replied on October 8, 2018
Add your own multi-line text field(s) and hide/show it based on the text box selection.
Checkboxes are numbered starting at 0.
$('.addlComments').hide(); // start hidden
$('#q19 input').change(function() {
if ($("input[id^=Field19-4]").is(':checked')) {
$('.addlComments').show();
} else {
$('.addlComments').hide();
}
});
0
0
replied on October 8, 2018
What about adding a 2nd checkbox with only an "Other" option? How would we make the 2 appear as a single checkbox field (remove the extra space between choice 4 & 5)?
0
0
replied on August 24, 2022
When I go to save the form to the repository after performing the script, it doesn't save the data that is entered into the text fields. How do I get the data that is entered saved into the form?
0
0
You are not allowed to follow up in this post.