Hi,
I have a basic yes/no multiple choice question, followed by a side-by-side which has a text entry column. Currently when the user selects no, the text entry boxes are disabled to prevent entry. However, if they select yes, enter data, then choose no, the data remains. I want to wipe all text boxes as well as disable them whenever no is chosen.
Does anybody know how I might go about achieving this?
Are you using some JS for this, if yes then please post here.
This is the JS that disabled the text entry boxes when the user clicks no on the above multiple choice question. There's an identical function for the yes choice that re-enables the text entry boxes.
var GPNo = jQuery( "input[id='QR~QID25~2']" );
var GPNoLabel = jQuery( "labelafor='QR~QID25~2']" )
var No = function(e) {
if (typeof e.isTrigger == 'undefined') {
var mV = (GPNoLabel.attr('class'));
var n = mV.search("q-checked");
if (n > 0)
{
jQuery(" id='QR~QID26#1~1~1']").prop("disabled", true);
jQuery("aid='QR~QID26#1~2~1']").prop("disabled", true);
jQuery("aid='QR~QID26#1~3~1']").prop("disabled", true);
jQuery("aid='QR~QID26#1~4~1']").prop("disabled", true);
}
}
}
GPNo.on('change',No);
Wherever you are disabling the text box just add .val('') as below
jQuery("[id='QR~QID26#1~1~1']").prop("disabled", true).val('');
Unfortunately not for radio button but you can change it to checkbox(multi answer) and then use below code:
jQuery("[id='QR~QID338#2~2~1']").prop("checked",false)
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.