Using source code to auto submit Radio button not working

  • jakec729
    Asked on September 17, 2017 at 4:18 PM

    I'm trying to make a poll that will auto submit once you click on the available options, or type in the "other" field to add your own option (in this case you'll hit the submit button).

    I have my form set up with a single radio input, with the idea being that when the user clicks their 'poll' answer the form will auto submit with that value.

    The form works great when you select a radio input and then press the submit button, but does not work when the submit button is removed and onDISABLEDclick="form.submit()" is added to each radio item to create the auto-submit functionality.

    The error I get is "incomplete values" for the required 'poll' field.

    I'm not sure why the selected value is not present by the time it is submitted.

  • jonathan
    Replied on September 17, 2017 at 4:24 PM

    I assume you were using the source code of the form since you were referring to a custom function code for the submit button of the form.

    Can you please share to us the URL of the website where you have used the form? We need to check the actual website where the form was used.

     

  • jakec729
    Replied on September 17, 2017 at 4:27 PM

    Here's the isolated implementation:

     

    https://codepen.io/jakecooperdesign/pen/oGjMjQ

  • jonathan
    Replied on September 17, 2017 at 4:34 PM

    Thank you for sharing the details. I checked your test codes and it actually work. The form auto submitted when selecting option in Radio button.

    What I suggest also is to review this similar discussion thread. It should help you compare the javascript code needed for auto submit. 

    How to auto submit form without using Submit button

    You can also just use the Global Countdown widget to auto submit form without using the source code implementation.

     

     

  • jakec729
    Replied on September 17, 2017 at 4:41 PM

    Unfortunately the code as it is doesn't work.

    When you click on a radio option (like on codepen url) the form submits, but it causes an "Incomplete value" error which prevents the submission (with proper submission value) from being logged into the jotform system. I tested the current implementation and no data is added when viewing the form submissions on jotform.com. I tried making the field not required, but when that happens the field is blank when submitted.

    When the form submitted in your tests, did your selection persist in the jotform backend?

    Is there something I'm missing?

     

    Thanks again for your help!

  • jonathan
    Replied on September 17, 2017 at 5:26 PM

    I did see the incomplete error as well when I test in the codepen website. But the auto submit did work.

    You will have to use a hosted implementation for the source code + custom javascript code to work on your implementation. As far as I know it will only work if you have everything embedded on a website(hosted).

     

  • jakec729
    Replied on September 17, 2017 at 5:33 PM

    Hosted implementation still does not work, here is a live version

    https://jakecooperdesign.github.io/yoxi-ui/

     

    Not sure where it's going wrong, because when I turn off the auto submit, and use an input button instead it seems to work fine.

     

  • jonathan
    Replied on September 17, 2017 at 5:39 PM

    Allow me more time to create a demo implementation. I'll post update here as soon as I can.