As explained here, and based on the answer given to that previous question, I'm trying to build a custom form that will act as a filter to two separate views. As per the answer received, I'm trying to build the resulting URL based upon user input. Here is my function so far:

function my_search_form($form, &$form_state) {

  $form['search_value'] = array(
    '#type' => 'textfield',
    '#title' => t('Search:'),

  $form['area'] = array(
    '#type' => 'select',
    '#options' => array(
      'songbook' => t('Songbook'),
      'blog' => t('Blog'),
    '#default_value' => 'songbook',

  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => 'Search',

  $form['#method'] = 'get';

  return $form;

So here's my problem: according to this comment on the forms api page, changing the #method to GET means that no submit or validate handler functions are called on form submission. How can I get access to the user submitted data if those handler functions aren't called?

  • Not sure I fully understand the problem, but why not use drupal_goto in the submit handler? drupal_goto('url', array('query'=>array('param1'=>'value1'))); – donutdan4114 Jul 25 '12 at 1:04
  • Form submission handlers should not use drupal_goto(). – kiamlaluno Jul 25 '12 at 1:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.