[development] formsapi question: saving additional fields' data

Earl Miles merlin at logrus.com
Tue Apr 25 20:34:48 UTC 2006


Nedjo Rogers wrote:
> 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.
You can add a #submit much like a #validate.


More information about the development mailing list