[development] menu item callback
John Morahan
john.morahan at gmail.com
Thu Oct 15 23:14:32 UTC 2009
Jeff Greenberg wrote:
> I hook menu with an item $items['admin/....'] and give it a page
> callback of drupal_get_form and the page arguments being the function in
> my module that defines the form. It's defined as a normal menu item.
>
>
> I click the menu item and up comes the form. So far everything as
> expected. What -isn't- expected is that in looking at the page source,
> the action for both this form, and the search form, are now both the
> path for this form.
>
>
That's normal. The action for any form is always the current page,
unless someone sets $form['#action'] explicitly. This works, because
when you submit the form (your form, or the search form) back to the
same URL, drupal_get_form() gets called again for that form, which in
turn checks if the form has been submitted, and handles the submission
if so.
At one point, the search form itself did explicitly set #action to work
around a bug - http://drupal.org/node/67648 - but this was eventually
removed in favour of a different fix.
-john
More information about the development
mailing list