2
votes

I am using Drupal webform and wonder whether it's possible to auto-submit a Webform?

Since Webform comes with %get[key] to fill the form fields by default values from a FORM GET URL, and so I'd like to save the user a submit button click. Possible? Thanks!

2

2 Answers

0
votes

You'll want to create a Drupal behavior in Javascript that applies some kind of logic to the check the form elements (i.e., submit once fields x, y, and z are filled in by the user). Because Drupal uses the jQuery form plugin, you can background submit the form with ajaxSubmit or simply trigger the form's submit event.

0
votes

To elaborate on David Eads' answer, using jQuery without Ajax, by pressing Enter:

  jQuery('#my-form .my-form-item input')
    .keypress(function(e) {
      if (e.which == 13) {
        e.preventDefault();
        jQuery('#my-form').submit();
      }
    });