I have a single question survey with multiple choices. The user can select more than one choice. I want to force response to this question. Instead of using the Force response option, I want to disable or grey out the submit button untill the question is answered.
Page 1 / 1
Hi Lubna,
You can add the following code in the JS onload function for single choice question:
var that = this ;
this.disableNextButton () ;
jQuery("input[type=radio]").change(function(){
var i = jQuery("input[type='radio']:checked").length ;
if(i != 0){
that.enableNextButton();
}
});
this is code if you want it for multi-choice question:
var that = this ;
this.disableNextButton () ;
jQuery("input[type=checkbox]").change(function(){
var i = jQuery("input[type='checkbox']:checked").length ;
if(i != 0){
that.enableNextButton();
}
else
that.disableNextButton();
});
this code is on assumption that you have only one question in that page
Regards
NiC
Hi Nic
This did not work. !
There are 3 questions. refer the screenshot. One is a statement, second is the actual question. third is to collect metadata.
If you see the screenshot, you might get a fair idea of what I am trying to do.
Lubna

hi Lubna,
This code should worked in the question you have mentioned , I wanted to say if there are similar question like a single choice or multiple choice question then it wont work:
var that = this ;
this.disableNextButton () ;
jQuery("input[type=checkbox]").change(function(){
var i = jQuery("input[type='checkbox']:checked").length ;
if(i != 0){
that.enableNextButton();
}
else
that.disableNextButton();
});
Here is a preview link to the Survey also attached is the
qsf for the same:
Hi Nic,
Still No Luck. :neutral:
!

> @NiC said:
> hi Lubna,
> This code should worked in the question you have mentioned , I wanted to say if there are similar question like a single choice or multiple choice question then it wont work:
>
>
> var that = this ;
> this.disableNextButton () ;
> jQuery("input[type=checkbox]").change(function(){
> var i = jQuery("input[type='checkbox']:checked").length ;
> if(i != 0){
> that.enableNextButton();
> }
> else
> that.disableNextButton();
> });
>
>
> Here is a preview link to the Survey also attached is the
> qsf for the same:
>
Hi @Lubna ,
Prees clear button in the JS tab and paste the code under js(OnReady) function
Thanks Shashi & Nic.
It fixed the issue.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.