0

I have set up a webform for simple user polling with an yes/no option, with a submit button.

  [ ] Yes
  [ ] No

  Submit

and the parameter is pass via URL as default, e.g.:

 http://example.com/event_form?option=y

Currently, the webform link is sent via email. So users click the link, open a browser, select an option or use the default, press submit, and see the confirmation message.

Is it possible to automate the submit click? Such that the submit button is automatically clicked after clicking on the link in email?

  • It is easy if you know how to write module. Are you expecting to have a solution with contrib modules? – Jimmy Ko Jul 12 '16 at 10:35
  • As long as it works with the webform module, please explain how to do that with a module... – ohho Jul 13 '16 at 2:46
0

Inject some javascript into the body using PHP can make auto submit to work by a param in URL:

 http://example.com/event_form?autosubmit=yes&option=y

For example, the webform node ID is 101:

<?php if ($_REQUEST['autosubmit']) { ?>

    <script>
    (function ($) {     
        $(document).ready(function(){
            $('form#webform-client-form-101').submit();
        });
    })(jQuery);
    </script>

<? } ?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.