Delay Submit button | XM Community
Skip to main content
Solved

Delay Submit button


Forum|alt.badge.img+3
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.

Best answer by Anonymous

> @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
View original

6 replies

NiC
QPN Level 5 ●●●●●
Forum|alt.badge.img+27
  • QPN Level 5 ●●●●●
  • 255 replies
  • March 21, 2019
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

Forum|alt.badge.img+3
  • Author
  • 16 replies
  • March 21, 2019
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

NiC
QPN Level 5 ●●●●●
Forum|alt.badge.img+27
  • QPN Level 5 ●●●●●
  • 255 replies
  • March 21, 2019
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:

Forum|alt.badge.img+3
  • Author
  • 16 replies
  • March 22, 2019
Hi Nic, Still No Luck. :neutral: !

  • 0 replies
  • Answer
  • March 22, 2019
> @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

Forum|alt.badge.img+3
  • Author
  • 16 replies
  • March 23, 2019
Thanks Shashi & Nic. It fixed the issue.

Leave a Reply