[development] hook_form

ekes ekes at aktivix.org
Tue Jul 28 08:30:15 UTC 2009

Hash: SHA1

Ole Kerpel wrote:
> I was wondering how I could implement the hook_form, in order to
> create a form within the Drupal generated form. Can I add php in the
> <mymodule>_form or does Drupal offer ways here?

Here it certainly sounds like you want hook_form_alter. You have a
Drupal generated form and you can add stuff to it.

> Here is my case. I am creating a module that stores nodes with
> several textfields. One of the fields is mandatory and should contain
> a url. The user must be able to search for the urls by posting
> keywords to an web service. When the result comes back the user must
> be able to select a url which is then stored in the right field.
> after that, the user is able to add some text and then submit the
> form the Drupal way.

Is it possibly an idea to make this field a special CCK (text/url) field
with appropriate widget? From what I understand, above, it is a two
stage process - so take this example: the node_reference field with the
http://drupal.org/project/popups_reference addition (if I recall
correctly it makes a jquery 'pop up' for creating the node which it then
uses to populate the node reference field).

- ---
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org


More information about the development mailing list