My form's submit handler is not being called -- ie, I have:
function my_form($form_stateL) {
$form = array();
ahah_helper_register($form, $form_state);
// etc...
}
function my_form_submit($form, &$form_state) {
dsm($form_state);
dsm('submit handler called?!');
}
my_form_submit is only called if I explicitly set it in $form['#submit'][].
| Comment | File | Size | Author |
|---|---|---|---|
| #12 | ahah_helper-submit-1231140-12.patch | 540 bytes | jasonlttl |
| #1 | 1231140.ahah_helper.form-submit-handler.patch | 538 bytes | joachim |
Comments
Comment #1
joachim commentedHere's a patch, but not sure if it's the right approach to chain submit functions!
We can't set another #submit in ahah_helper_register() because we don't know the form ID at that point.
Comment #2
lifer commentedBased on some testing I think I have the same problem.
This patch doesn't seem to change much though :(
Comment #3
ryan osītis commentedSubscribe.
Comment #4
mikedotexe commentedHuge subscribe. I'm kind of new at Drupal and thought I was doing something wrong.
(*EDIT:)
I just found that adding a
It seems to do it twice sometimes, though, but at least it's semi-working.
Comment #5
d.sibaud commentedthe above patch solved the issue, thanks
Comment #6
WildKitten commentedThe patch solved it for me but with minor change.
With this patch I get error:
But when I remove
&from$function($form, &$form_state);, everything works fine.Comment #7
nickgs commentedThanks joachim,
I had the same behavior and your patch worked for me.
Switching to reviewed and tested.
Thanks.
Nick
Comment #8
maddentim commentedI applied patch and it resolved my issue of the regular submit handler not firing... Thank joachim!
Comment #9
dpellerin commentedThe patch worked for me as well.
Comment #10
steveoliver commentedWhat's happening here is the
ahah_helper_registerfunction is addingahah_helper_real_submitto the array of submit callbacks:The
ahah_helper_real_submitcallback is a simple function that clears out the form_state storage:In my case I am using the storage as well as the form's submit handler several times (in a multi-step form), so I do not want the storage cleared on submit. I am handling the clearing of the storage on my own. So immediately after
ahah_helper_register, I take back (overwrite) the array of submit handlers like this:This
ahah_helper_real_submitseems a generic way to handle cleanup of form_state storage for single-page/iteration forms.Comment #11
jasonlttl commentedThe patch worked for me too. Thanks!
Comment #12
jasonlttl commentedI went to start deploying this with the patch from #1 (joachim) and noticed what wildkitten (#6) said about a call-time pass by reference was true. So here's the same patch re-rolled with that fixed.
Comment #13
splash112 commentedHad the same problem, but adding the submit function explicitly to the form made iet work:
'#submit' => array('my_form_edit_form_submit'),
Thanks btw for the great module, got something working that I thought I could never do! Many thanks!
Comment #14
jerome72 commentedjasonlttl's patch worked for me. Many thanks!
Comment #15
sumeet.pareek commentedI had the same problem, and the patch in #12 worked for me too.
Applying the patch via `git apply` would throw the below error.
But using a `patch -p1` successfully applies the patch.
Comment #16
texas-bronius commentedThis looks good for expected form_id_submit named form submit handlers. What about for form validation and submit handlers added thusly:
Is there a good and programmatic way of, instead or in addition to, loading the form creation and restoring the
#submit[]array function names?Comment #17
texas-bronius commentedWould it be better if instead of replacing the existing form submit handlers that we actually return false or something from the ahah submit handler? Would that do it? or anything?