Posted by beginner on September 14, 2006 at 8:02am
Jump to:
| Project: | Drupal core |
| Version: | 5.x-dev |
| Component: | forms system |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (won't fix) |
Issue Summary
When programmatically submitting a form, drupal_execute is returning a string which is the redirect path (e.g. admin/content/taxonomy after submitting a term).
The problem is that often we want the ID of whatever has been submitted (nid, tid, fid, etc). We miss the equivalent of mysql_insert_id().
In the case of a node, we can get the nid from the returned path (node/nid), but for many other forms, we have to go on very roundabout ways to get the ID (i.e. query the DB for the term we inserted, hoping there is no identical terms, or two forums with the same name, etc..)
Comments
#1
I am not willing to fix this. You have the $form_values global and also often the redirect URL will contain the ID (go to the newly submitted node for eg).
#2
It's more than willingness -- there is no real good way of defining what to return. Use $form_values.
#3
Drupal 6 now returns more useful data.
See http://drupal.org/node/144132#redirect