Create a form that auto-submits after selecting one option

I’m trying to create a form for my Help Center website. I want it to auto-submit after the user selects an emoji (set up as a radio button) without a “Submit” button.

Here’s an example of the page that I’m trying to implement this for. I currently hid the “Submit” button, so clicking on the radio buttons does nothing. Otherwise, everything works as expected if I unhide the “Submit” button.

Can anyone advise on how to do this?

Screenshot 2022-12-09 at 10.16.30 AM

I can’t access your page;

image

But try this;

  • To each of those radio buttons, add a custom attribute of auto-submit
  • Add this code into your page’s </body> section;
<script>
$(function() {
  
  $("input[type='radio'][auto-submit]").change(function() {
    $(this).closest("form").submit();
  });
  
});
</script>
1 Like

Thank you so much Michael!!! This is exactly what I needed.

Sorry for the broken link – my site was still in staging back then and I ended up publishing to our custom domain.

1 Like

Hey, I really need this solution to work on my project as I can’t find any other method but I don’t know what custom attribute to label it as? I am essentially making the same thing as Angie with radio buttons. What is the name for the value “auto-submit”?

Set the name of the attribute to auto-submit. It doesn’t need a value.