[Solved] How to create an auto submit on radio button selection.

1

Hi everyone,

I would like to build a survey that acts as if I clicked the “next” page button after I make a selection on a radio button question.

I know that I can set the survey interaction mode to one at a time, but when I get onto the second page I don’t want that functionality, so I need it to only be on the first page.

I am trying to figure out how I can add javascript that creates this action “onchange” for the radio button.

Thanks for the assistance!

tryingveryhard answered

    Best answer

    1

    You know what, I was actually able to answer this one.

    If anyone is interested, here is the javascript action I implemented.

    $(document).ready(function() {
         // make following action fire when radio button changes
         $(‘input[type=radio]’).change(function(){
              // find the submit button and click it on the previous action
              $(‘input[type=submit]’).click()
              });
         });

     

    Jacob Hayslett selected as best answer
      0

      This worked for me:

       

      $(document).ready(function() {
      $(‘.sg-input-radio’).click(function(){
      $(‘.sg-next-button’).trigger(‘click’);
      });
      });

      tryingveryhard answered
        0

        I used this in an image select question and it works for me.  I would assume ti would work for oyu as well.

         

        $(“.sg-imageselect-item”).click(function(){
            $(“.sg-next-button”).trigger(“click”);
        });

        Mike Miller answered
          0

          Jacob, I tried your solution, but the next page does not appear, but the same page is loading again. If I put the $(‘input[type=submit]’).click() code in 3 subsequent radio button questions on separate pages, the program jumps from the first to the second question (=correct), but then from the second question back to the first one and does not proceed to the 3rd page. 

          What did I wrong? Is there another piece of code telling the program which page to load after submitting the form?

          strasser90 answered
            ×

            Login

            Question stats

            • Active
            • Views1008 times
            • Answers4 answers
            • Followers1 follower