### Eclipse Workspace Patch 1.0 #P travel_site Index: sites/all/modules/ahah_helper/ahah_helper.module =================================================================== --- sites/all/modules/ahah_helper/ahah_helper.module (revision 47917) +++ sites/all/modules/ahah_helper/ahah_helper.module (working copy) @@ -179,7 +179,9 @@ // Disable #required and #element_validate validation. _ahah_helper_disable_validation($form); } - + + $form['#after_build'][] = '_ahah_helper_after_build'; + // Build, validate and if possible, submit the form. drupal_process_form($form_id, $form, $form_state); // This call recreates the form relying solely on the form_state that the @@ -204,6 +206,27 @@ //---------------------------------------------------------------------------- // Private functions. +/** + * Removes validation when not needed AFTER the form has been rebuilt + * @param $form + * @param $form_state + */ +//TODO can this completely replace the identical call at line 172? +function _ahah_helper_after_build($form, $form_state) { + if (!isset($form_state['values']['op'])) { + // For the default "{$form_id}_validate" and "{$form_id}_submit" handlers. + $form['#validate'] = NULL; + $form['#submit'] = NULL; + // For customly set #validate and #submit handlers. + $form_state['submit_handlers'] = NULL; + $form_state['validate_handlers'] = NULL; + // Disable #required and #element_validate validation. + _ahah_helper_disable_validation($form); + } + + return $form; + +} /** * Given a form by reference and an array of parents, return the corresponding