[drupal-docs] Forms API quick start

Dries Buytaert dries at buytaert.net
Sat Oct 22 12:26:03 UTC 2005


Some comments on the Form API quickguide at http://cvs.drupal.org/ 
viewcvs/*checkout*/drupal/contributions/docs/developer/topics/ 
forms_api.html

1. Initially, my form execute function did not appear to get called.   
It took me 15 minutes to figure out that it somehow conflicted with  
the menu callbacks.  Can someone shed some light on this and extend  
the documentation?  It's probably a common problem.  The same is  
probably true for the form validation function.

2. It would saved me some grepping if the quickstart showed me how to  
validate a URL, e-mail address or integer value.  Form validation is  
an important step; having some additional examples would be _really_  
useful.

3. Required fields do not appear to get validated automatically.  Do  
I need to define a validation function just to check required fields  
and to emit friendly error messages?  Without such explicit  
validation function, the form gets executed even though the forms API  
knows it is not incorrect/complete.  I'd like to see that clarified  
in the quickstart too.

4. I wonder how to deal with forms that have 2 buttons (eg. Save and  
Delete).  Where would one put the "dispatch logic".

--
Dries Buytaert  ::  http://www.buytaert.net/




More information about the drupal-docs mailing list