is there any way to use simple FAPI (such as dropdown selection box) without processing it with drupal_build_form?

The thing is, I have a page with a custom table view and a drop-down selection widget that limits the view. The only thing that I need the selection widget to do is to redirect me to '...the_page/id_of_selected_item' (or 'the_page?gid=id_of_selected_item). And it seems to me that using full form support for such a simple task (which a basic redirect surely is) is a bit of a overkill...

I know I can render the selection widget easily without the form support but then neither AJAX nor simple submit button (that would send the data trough PHP POST) works.

BTW: Is there any way to do simple PHP forms in Drupal?

  • 4
    Nope - if you want the FAPI goodness (AJAX, CSRF protection, etc) you have to use it as it was intended. The FAPI is Drupal's way of doing "simple PHP forms". If you consider it overkill (must say I disagree, if you want a form you want a form, so why not use the provided API?) then just render some HTML tags manually
    – Clive
    Commented Jun 14, 2014 at 9:10

1 Answer 1


From https://api.drupal.org/api/drupal/includes%21form.inc/function/drupal_get_form/7.x :

This function should be used instead of drupal_build_form() when $form_state is not needed (i.e., when initially rendering the form) and is often used as a menu callback.

It still does a drupal_build_form under the hood, though, but at least you don't have to do it. Mind you, it may or may not work in your specific case, depending on where / how you create and call your form.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.