programmatically submitting form: drupal_execute should return useful data.

beginner - September 14, 2006 - 08:02
Project:Drupal
Version:5.x-dev
Component:forms system
Category:bug report
Priority:normal
Assigned:Unassigned
Status:won't fix
Description

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..)

#1

chx - October 19, 2006 - 23:36
Status:active» won't fix

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

chx - October 19, 2006 - 23:37

It's more than willingness -- there is no real good way of defining what to return. Use $form_values.

#3

Steven Jones - March 10, 2008 - 07:41
Version:x.y.z» 5.x-dev

Drupal 6 now returns more useful data.

See http://drupal.org/node/144132#redirect

 
 

Drupal is a registered trademark of Dries Buytaert.