PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Submit on radio button selection

  1. rbl
    Member

    Hi!
    I would like to know if it's possible to submit forms when the user clicks a radio button.

    The site I'm working on is using forms as polls and each form has a multiple choice field where all the choices are add and presented to the user as radiobuttons.
    Since they quite simple, it would be great to submit them like that.

    Thanks!
    Ricardo

    Posted 13 years ago on Monday June 27, 2011 | Permalink
  2. You can add the following jQuery code snippet to your page.
    Make sure you replace 3 (in input_3) with your radio button field ID and 169 (in gform_169) with your form ID.

    <script type="text/javascript">
                jQuery(document).ready(function(){
                    jQuery("input[name='input_3']").change(function(){
                        jQuery("#gform_169").submit();
                    });
                });
    </script>

    If you are not sure where to add this snippet, take a look at the following doc page.
    http://www.gravityhelp.com/documentation/page/Where_Do_I_Put_This_Code%3F

    Also, you will need to make sure the jQuery library is added to your form page.

    Posted 13 years ago on Monday June 27, 2011 | Permalink
  3. rbl
    Member

    Thanks Alex! Works great! =)

    Ricardo

    Posted 13 years ago on Monday June 27, 2011 | Permalink

This topic has been resolved and has been closed to new replies.