In the old form api, hook_form_alter had $form['#post'] available (with raw $_POST data) for checking submitted values. That's gone as of FAPI 3 landing. The attached patch sets $form_state['post'] for now.
Needs review by FAPI experts :)
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | form_18.patch | 4.99 KB | chx |
| #8 | form_17.patch | 4.99 KB | chx |
| #7 | form_16.patch | 3.56 KB | chx |
| #5 | form_15.patch | 449 bytes | chx |
| form-state-post.patch | 848 bytes | walkah |
Comments
Comment #1
moshe weitzman commentedcode looks fine. trivial even ... perhaps elaborate on how you are using this.
Comment #2
walkah commentedVery simply it allows hook_form_alter to make it's form alterations based on submitted values. Specifically, for OpenID - since I'm altering the user_login form (and block) - I change the #validate and #submit values to use the openid submit function.
There are, of course, other possible usages - frankly, I consider this a regression - as the functionality was available in FAPI previously.
Comment #3
eaton commentedI think there would be ways to get around this -- other approaches to swaping #validation handlers -- but keeping $_POST around in the $form_state is probably the best solution for now; that's what $form_state is for.
My only thought is that it might be useful to keep $form_state['post'] around; even after the 'values' array is built it can be useful for comparison purposes...
Marking RTBC as-is, though. Thanks, walkah.
Comment #4
dries commentedCommitted to CVS HEAD.
Comment #5
chx commentedConsistency.
Comment #6
chx commentedConsistency but let it be #post.
Comment #7
chx commentedIf the issue is what the title says then this is the correct way: add back $form['#post'] .
Comment #8
chx commentedWhile at it let's make the input for drupal_execute $form_state['post'] sounds more logical.
Comment #9
eaton commentedI agree wholeheartedly with the change to drupal_execute; calling the input for that form_values is pretty deceptive, since it's treated as post rather than the cleaned up values. Could lead to confusion.
Comment #10
eaton commentedAnd it even applies against the latest HEAD!
Comment #11
chx commentedUgh! I put the , TRUE to the wrong drupal_prepare_form call which would cause rebuilt form (we formerly called them multistep) to become #programmed ... this would have been a very hard to catch bug.
Comment #12
moshe weitzman commentedso, we want this one or no?
Comment #13
catchNo longer applies - this been fixed elsewhere?
Comment #14
dpearcefl commentedIs this still a problem in current D6?
Comment #15
dpearcefl commented