[development] formsapi question: saving additional fields' data

Nedjo Rogers nedjo at islandnet.com
Tue Apr 25 20:10:11 UTC 2006


We can easily add fields to existing forms. Do we have a way to save their 
data?

Example: I want to extend blocks' configuration pages. I can form_alter 
where $form_id = 'block_admin_configure', adding new fields. But 
block_admin_configure_submit() won't look for or save the added fields.

To do so, I can only think of (a) (mis)using the #validate attribute to 
specify a function to pass the data to and save them there, or (b) hijacking 
the form by changing the form_id and sending it to a custom _submit 
function, which saves the custom fields and then invokes the original
_submit function.

Better approaches? Tips? Solutions that people have used elsewhere? Am I 
overlooking a relevant Forms API attribute?

Thanks.



More information about the development mailing list