Change next "arrow" button to in-page Submit based on question response. | XM Community
Skip to main content
Question

Change next "arrow" button to in-page Submit based on question response.


KBrady
Level 2 ●●
Forum|alt.badge.img+11
  • Level 2 ●●
  • 37 replies

I have a yes or no question in my survey.  If the recipient answers yes, then they will move forward to other questions, by using an arrow on the page.  Should the recipient select “no”, I would like the arrow to change to a change “Submit”. I would like this to be displayed in the same page and not require a new page to submit.  Has anyone done this before?

17 replies

qualtrics_nerd
Level 5 ●●●●●
Forum|alt.badge.img+19
  • Level 5 ●●●●●
  • 225 replies
  • May 10, 2023

Hi @KBrady ,

By submit do you mean it will be end of the survey?


KBrady
Level 2 ●●
Forum|alt.badge.img+11
  • Author
  • Level 2 ●●
  • 37 replies
  • May 10, 2023

Yes if you said “no”, otherwise it’ll continue.

 


Shashi
Level 8 ●●●●●●●●
Forum|alt.badge.img+32
  • Level 8 ●●●●●●●●
  • 633 replies
  • May 10, 2023

Try the below code:

jQuery("#"+this.questionId+" input[type='radio']").on('click change',function(){
		if(jQuery(this).attr("choiceid")==1)
			jQuery("#NextButton").attr({"value":"→","title":"→"});
		else
			jQuery("#NextButton").attr({"value":"Submit","title":"Submit"});
	});

 


KBrady
Level 2 ●●
Forum|alt.badge.img+11
  • Author
  • Level 2 ●●
  • 37 replies
  • May 10, 2023

Thank you Shashi it did not work.  My QID is QID11 Is this how I should update the code?

jQuery("#"+this.QID11+" input[type='radio']").on('click change',function(){
        if(jQuery(this).attr("choiceid")==1)
            jQuery("#NextButton").attr({"value":"→","title":"→"});
        else
            jQuery("#NextButton").attr({"value":"Submit","title":"Submit"});
    });

 


Shashi
Level 8 ●●●●●●●●
Forum|alt.badge.img+32
  • Level 8 ●●●●●●●●
  • 633 replies
  • May 10, 2023
KBrady wrote:

Thank you Shashi it did not work.  My QID is QID11 Is this how I should update the code?

jQuery("#"+this.QID11+" input[type='radio']").on('click change',function(){
        if(jQuery(this).attr("choiceid")==1)
            jQuery("#NextButton").attr({"value":"→","title":"→"});
        else
            jQuery("#NextButton").attr({"value":"Submit","title":"Submit"});
    });

 

No edits needed, just use code as it is.


KBrady
Level 2 ●●
Forum|alt.badge.img+11
  • Author
  • Level 2 ●●
  • 37 replies
  • May 10, 2023

Thank you. Unfortunately it did not work. 


Shashi
Level 8 ●●●●●●●●
Forum|alt.badge.img+32
  • Level 8 ●●●●●●●●
  • 633 replies
  • May 10, 2023

Can you check the choice id of the ‘yes’ option by using browser inspect element?


KBrady
Level 2 ●●
Forum|alt.badge.img+11
  • Author
  • Level 2 ●●
  • 37 replies
  • May 10, 2023

 


Shashi
Level 8 ●●●●●●●●
Forum|alt.badge.img+32
  • Level 8 ●●●●●●●●
  • 633 replies
  • May 10, 2023

Can you post screen shot how you have paste the code?


KBrady
Level 2 ●●
Forum|alt.badge.img+11
  • Author
  • Level 2 ●●
  • 37 replies
  • May 10, 2023

 


KBrady
Level 2 ●●
Forum|alt.badge.img+11
  • Author
  • Level 2 ●●
  • 37 replies
  • May 10, 2023

jQuery("#"+this.QID11+" input[type='radio']").on('click change',function(){
        if(jQuery(this).attr("choiceid")==1)
            jQuery("#NextButton").attr({"value":"→","title":"→"});
        else
            jQuery("#NextButton").attr({"value":"Submit","title":"Submit"});
    });

 


KBrady
Level 2 ●●
Forum|alt.badge.img+11
  • Author
  • Level 2 ●●
  • 37 replies
  • May 10, 2023

I pasted the above in the java script dialog box


Shashi
Level 8 ●●●●●●●●
Forum|alt.badge.img+32
  • Level 8 ●●●●●●●●
  • 633 replies
  • May 10, 2023

 


KBrady
Level 2 ●●
Forum|alt.badge.img+11
  • Author
  • Level 2 ●●
  • 37 replies
  • May 10, 2023

Hi Shashi, I entered the details exactly as above. Do I need to call out the choice ID as well?


Shashi
Level 8 ●●●●●●●●
Forum|alt.badge.img+32
  • Level 8 ●●●●●●●●
  • 633 replies
  • May 10, 2023
KBrady wrote:

Hi Shashi, I entered the details exactly as above. Do I need to call out the choice ID as well?

So on clicking No button is Next button text not changed?


KBrady
Level 2 ●●
Forum|alt.badge.img+11
  • Author
  • Level 2 ●●
  • 37 replies
  • May 10, 2023

Unfortunately no. But I’m wondering… Since if the user selects no, QID11 becomes the last question in the survey. Prior to submitting I am required to display our privacy statement. I have a follow-up text value only question which also displays when no is selected.  Could that be the issue?


Umang Upadhyay
QPN Level 4 ●●●●
Forum|alt.badge.img+19
  • QPN Level 4 ●●●●
  • 117 replies
  • December 13, 2023

Did it work?