Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The values at $element[#post] are now in $form_state['input']. I didn't see that documented anywhere.
Comments
Comment #1
arianek CreditAttribution: arianek commentedmoving to core docs queue - this may be dealt with by now.
tha_sun said (in IRC) $element['#post'] == $form_state['input'] now, but you never want to use 'input' directly, always use 'values'
Comment #2
jhodgdonI don't see this documented on
http://drupal.org/update/modules/6/7
and it sounds like it should be?
Comment #3
jhodgdontagging
Comment #4
jhodgdonDoes anyone have a clue about what issue this was introduced in? It's still not documented in the 6/7 module update guide.
Comment #5
sun#1 is correct.
$element['#post'] and $form['#post'] got removed in a major overhaul of Form API. That must have been early in the D7 cycle, as I didn't participate in that.
However, for 99.9% lines of code that need to be updated, it's:
D6:
D7:
Note that $element['#post'] always contained the full $_POST, even though it was in $element (major WTF). To access the submitted values for a (possibly expanded/processed) element, there's no difference between D6 and D7:
For the sake of completeness, $form_state['values'] is not really identical to $element['#post']. The latter contained the unprocessed and not validated user input in D6. Usage of that data is generally discouraged, but if you absolutely need it, then it's available in $form_state['input'].
Lastly, aside from the major Form API overhaul, I guess that $element['#post'] was entirely removed, because it implies "POST", whereas forms can also support
$form_state['method'] = 'GET';
Comment #6
sunWith the help @chx on IRC:
If you had a good, solid reason to use $form['#post'] or $element['#post'] then now you can use $form_state['input'].
However, processed values are available in $form_state['values'] and the element that triggered the form submission is in $form_state['triggering element'] and you are highly encouraged to use those. Never copy data from $form_state['input'] into the database.
Otherwise, use $element['#value'] or $form_state['values'].
Comment #7
jhodgdonThanks - this information is now at
http://drupal.org/update/modules/6/7#element_post