By Anonymous (not verified) on
Hi--am trying to add a Cancel button to my form, but the form has required fields. I know how to specify a custom submit function for the cancel button, but how do I keep drupal_validate_form from firing???
THanks!
Doug
Comments
How I accomplishsed it.
I simply used drupal_get_messages('error'); drupal_goto('somewhere/else'); for the action of the $form_state['clicked_button']['#value'] == 'Cancel'. The drupal_get_messages('error') will clear the validation error message queue. Both the drupal_get_messages('error') and the drupal_goto('somewhere/else') calls need to be in the _validate callback.