[drupal-devel] Forms API conversion help

Chris Johnson chris at tinpixel.com
Fri Oct 14 15:13:19 UTC 2005


I am in the process of trying to convert the ezmlm module to the new forms 
API.  I am doing this so I can learn the forms API.  I am one of the 
maintainers of the ezmlm module and it is a very, very simple module.

Once I learn the forms API fairly well, I will be happy to help other people 
with their conversion efforts, write more documentation on the API and/or 
convert more modules.  I just need to get it all clear in my head first.

However, I'm having some problems converting a simple form in my module.  I 
spent several hours reading all the latest documentation and working on it 
last night, and I've run into a few things where I am not clear on how it 
should work.

If anyone is willing to give me some help, you can view the before and after 
code here:

http://phpfi.com/82366

Questions:
1. Is the #action key in the first form[] element the right way to specify 
where to post the form?

2. What's the proper array element index where it says "WHAT_GOES_HERE" for a 
non-form item message that needs to be injected into the form at that point? 
Is #markup the right type?  Seems like it is.

3. What's the correct #type for my hidden form element?

4. What's the correct form array secondary index for an array of checkboxes? 
In the old form API, one used names like 'my_checkbox_list][' in order to 
generate HTML like this:
		<input type="checkbox" name="edit[my_checkbox_list][]">
How is that done with the new API?


Thanks,
Chris Johnson
31 hours until I leave for Amsterdam!  :-)




More information about the drupal-devel mailing list