Closed (won't fix)
Project:
Drupal core
Version:
5.x-dev
Component:
forms system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
14 Sep 2006 at 08:02 UTC
Updated:
10 Mar 2008 at 07:41 UTC
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
Comment #1
chx commentedI 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).
Comment #2
chx commentedIt's more than willingness -- there is no real good way of defining what to return. Use $form_values.
Comment #3
steven jones commentedDrupal 6 now returns more useful data.
See http://drupal.org/node/144132#redirect