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

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?

Hi @KBrady ,

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


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

 


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"});
});

 


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

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

 


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

jQuery("#"+this.QID11+" inputttype='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.


Thank you. Unfortunately it did not work. 


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


 


Can you post screen shot how you have paste 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"});
    });

 


I pasted the above in the java script dialog box


 


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


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?


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?


Did it work?

 


Leave a Reply