I have a complex page with a few blocks including a Views block that I need to contextually filter on. How can I create a form in Drupal that passes arguments (selections from the form, i.e. text, checkboxes) to the URL of the page. For example:

PATH: http://example.com/test_page


    $form['pages'] = array(
    '#type' => 'fieldset',
    '#title' => t('Data'),
    '#collapsible' => FALSE,
    '#collapsed' => FALSE,

    $form['pages']['title'] = array(
    '#type'          => 'textarea',
    '#title'         => t('Title'),
    '#rows'             => 5,
    '#resizable'    => FALSE,
  $form['submit'] = array('#type' => 'submit', '#value' => t('Submit'));

I type in test "Test" in the 'Title' textbox and click 'Submit'. The current page url is changed to:


Any ideas? Thanks!

  • This should help, it's basically the same principle: drupal.stackexchange.com/questions/76416/… – Clive Jun 18 '13 at 20:45
  • Clive - There are two functions referred to in the URL you gave that aren't defined. I thought these were hooks but it seems they are not. Any ideas? – Ken J Jun 19 '13 at 10:26
  • I ended adding drupal_goto to my hook_form_submit and then using hook_init to grab the page arguments. – Ken J Jun 19 '13 at 13:35
  • Those are 'insert your code here' functions, their operation will change depending on what you're trying to do – Clive Jun 19 '13 at 13:39

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.