My webform has a variety of webform components (text fields, checkboxes and drop down menus) on it. A few of the text fields are mandatory/required. The webform works perfectly as long as the user fills in all of the required fields on their first try. If they miss a required field, validation seemingly disables the submit button even after the user completes the mandatory fields.
Aside from disabling the submit button, validation works correctly if a user does not fill in one or more of the mandatory fields. The field(s) are highlighted in red and messages appear prompting the user to fill the fields out. It appears that the problem is specific to the submit button.
The AJAX loading graphic appears briefly and then disappears when a user clicks on the submit button after correcting validation errors, but the form never submits.
The form has additional submit actions attached to it in a custom module. The form also uses the CAPTCHA module.
The additional custom module for the form contains the following code:
function mytheme_form_alter(&$form, &$form_state,$form_id){
if($form_id == 'webform_client_form_60983') {
array_unshift($form['#submit'], 'media_kit_node_form_submit');
}
}
function media_kit_node_form_submit($form, &$form_state) {
/* A lot of code looking at $form_state['values']['submitted'], doing mysql queries, creating email messages and providing the user with a confirmation message. */
}
Has anyone else experienced this and if so, is there a fix? Is there something that may be missing from my custom submit function? Any help is very much appreciated.
Comments
Comment #1
quicksketchThis indicates to me that you have an add-on module enabled on your site that is submitting the form via AJAX. Webform does not include any built-in AJAX submission ability. Considering Drupal disables submit buttons after they have been clicked while the AJAX request is processing, that module is likely causing this problem.
Comment #2
hbat66 commentedThanks, quickketch. I looked and can confirm that the site does not have an additional module requiring webform data to be submitted by AJAX.
Comment #3
quicksketchWhat about Clientside Validation module? I can't see why you'd see an AJAX loading icon when Webform doesn't do any AJAX submissions.
Comment #4
hbat66 commentedI've identified the js causing webform data to be submitted with AJAX. The culprit js is: /misc/jquery.form.js
The following modules call drupal_add_js('jquery.form.js') in our site:
• ctools module
• imce module
• views module
The problem was resolved by removing the $scripts variable from my form's template and then adding the raw needed js, minus jquery.form.js', right onto the template.
Comment #5
quicksketchHmm, that file is used in many places throughout Drupal, such as on file uploads and AJAX-enabled views. Removing it forcibly will cause some parts of Drupal to not work properly any more. You should investigate where it is being added and prevent it from being called in the first place, rather than removing it across the board.
Comment #6
quicksketchClosing after lack of activity.