[development] Multiple Forms, single form handler
Peter Wolanin
pwolanin at gmail.com
Wed Jun 20 00:19:26 UTC 2007
You're making it too complicated - you can set the form #base, to get
it to use an alternate 'base' for the validate and submit functions.
see, for example: http://drupal.org/node/73973
and also: http://api.drupal.org/api/5/file/developer/topics/forms_api_reference.html#base
and please read these API docs well.
-Peter
On 6/19/07, James McLean <james.mclean at gmail.com> wrote:
> Howdy,
>
> I'm working with a module called 'invite' (not sure if its drupal core
> or not) and i've added some hooks to allow it to work as a block as
> well as a regular module. The block is working fine and I have managed
> to build a form using the standard Drupal forms API successfully.
>
> The form submits to my validate function correctly and validates the
> submitted details as it should.
>
> Now, in order to save time and re-use existing code, I would like the
> form in my block to use the same methods and routines for saving
> information that the main form uses when you view it directly and fill
> out that form and submit that (http://drupal.local/invite/). The main
> form has two fields that are submitted (email address, required -
> description, not required) and my Block form has a single field (email
> address).
>
> The form built in my block is named 'invites_block_form' and the main
> form is named 'invite_form'
>
> I've attempted to use hook_forms() to achieve this behavior as
> outlined in the 'Pro Drupal Development' book but cant quite get my
> head around how to achieve it.
>
> If anyone could provide some insight into how to achieve this I would
> be greatful.
>
> Cheers,
>
> James McLean
>
More information about the development
mailing list