[development] Forms API newbie guide?

Shawn sgrover at open2space.com
Mon Jun 19 02:23:56 UTC 2006

Karoly Negyesi wrote:
> Start from http://drupal.org/node/33338 there are lots to read.
> Upload the code somewhere where we can read (drupal.pastebin.com works 
> for short code) and you may get some actual help :)
> NK

Thanks for the reply.  I've uploaded my _submit function to 
drupal.pastebin.com. http://drupal.pastebin.com/717633 (seems to be 
running a little slow right now....)

The problem I'm having is determining when I should be doing an update 
instead of an insert.  The insert part works great.  The update never 

the suggested documentation is a great resource if I want to know how a 
particular function works.  Where I'm having problems is understanding 
how all the parts of the framework are related.  It took me two days to 
figure out that I needed the "name" part of the drupal_get_form 
function, and then could use that name in relation to my other functions 
(name_subit for example).  And my usual troubleshooting techniques of 
dumping variable values, and using "I'm here" type entries do not work 
in the validation or submit functions.

My traditional approach to handling inserts/updates is to check the ID 
value for my record.  If it's not set (zero), then it's an insert, 
otherwise it's an update.  Is there a different/better approach to use 
in modules?

Thanks for any tips.


More information about the development mailing list