Drupal 5 FAPI... finding $form_values, replacing $_POST['edit']
Upgrading a module from Drupal 4.7 to Drupal 5, form issues (FAPI, or Form Application Programming Interface).
This gets a blog entry rather than Agaric's tech documentation page because this is still anecdotal rather than canonical.
Agaric, pretty much for the fun of it, is updating the taxonomy_switch module to Drupal 5. The problematic part of this 4.7 module seems to be replacing use of $_POST['edit']
with the now recommended $form_values
.
UPDATE: If you just replace $_POST['edit']
with $_POST
everything works. It doesn't feel pure and Drupal 5-y but it works!
See taxonomy_switch update to Drupal 5 for where this information is put into play, and all the below on how to really properly do it could be used.
Keywords:
drupal $_POST edit
$form_values empty
/* drupal_get_form in the API has only one variable: http://api.drupal.org/api/5/function/drupal_get_form
* so how can this work?
* $output = drupal_get_form('taxonomy_switch_classify_form', $record);
* It must add the # variables to the ID-named function. But I don't need any. */
Probably the best summary on the new multipart forms:
http://jeff.viapositiva.net/drupal/dynamic-forms
The official guide:
http://api.drupal.org/api/5/file/developer/topics/forms_api.html
http://api.drupal.org/api/HEAD/file/developer/topics/forms_api_reference.html
Possibly related:
http://www.lullabot.com/articles/drupal_5_making_forms_that_display_their_own_results
Place to answer back if explanations found:
$form_values only available in validate function
http://drupal.org/node/117485
And of course: Converting 4.7.x modules to 5.x
http://drupal.org/node/64279
Basic debugging / learning programming technique:
drupal_set_message(''. print_r($var, TRUE) . '
');
Comments
Post new comment