Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3341966
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T00:47:01+00:00 2026-05-18T00:47:01+00:00

I want a simple filter form, and a table below it. When the user

  • 0

I want a simple filter form, and a table below it. When the user changes the option on the select form, the table automaticaly changes. I think thats done with ahah.

I want this (some things can change, like the fieldset containing the table, and other stuff):

But working.. of course..

I’m currently showing that page using one function. It’s a complete mess and something like “NEVER DO THIS”, but i’m researching and trying some stuff as i’m a drupal learner.
This is the relevant code:

    form = array();  
    ahah_helper_register($form, $form_state);  
    //query here, build $options for the select

$form['listar_veics'] = array(  
        '#type'   => 'fieldset',  
    '#prefix' => '<div id="listar-veics-wrapper">',   
    '#suffix' => '</div>',  
    '#tree'   => TRUE,
    );

if (!isset($form_state['values']['listar_veics']['filial']))
    $choice = 1;
else 
    $choice = $form_state['values']['listar_veics']['filial'];


$form['listar_veics']['filial'] = array(
    '#type' => 'select', 
    '#title' => "Listar veículos da filial", 
    '#options' => $filiais,
    '#default_value' => $choice,
    '#ahah' => array(
        'event'     => 'change',
        'path'      => ahah_helper_path(array('listar_veics')),
        'wrapper'   => 'listar-veics-wrapper',
        'method'    => 'replace',
        ),
);

//query for the rows i wanna show

//building $data array, the rows array

//building $header, as an array of strings

$table = theme_table($header, $data);

$page = drupal_render($form);
$page .= $table;
return $page;

So in this code, drupal will only replace the form itself, when i change the option on the select, it shows the new value on the select, but the table isnt rendered again thus not changing.

Thanks, apreciate every suggestion.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T00:47:02+00:00Added an answer on May 18, 2026 at 12:47 am

    I recommend looking at the views module.

    http://drupal.org/project/views

    With that installed, you can create a custom query.

    1. Add all the fields that you would like displayed on your table. (Placa, Marca)
    2. Then add any filters that you would like to limit your query by. (Listar veiculos da filial)
    3. When adding the filter you “expose” it so that when looking at the query, you can change the options on the page.
    4. Then if you want to view what you just made, you need to add a display. If you make it a page display, you can set the path directly to the table.

    For more information might I recommend http://gotdrupal.com/videos/drupal-views-tutorial.

    If you want neater exposed fields I might also recommend http://drupal.org/project/better_exposed_filters

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing simple filter in Android and want to use ExpandableListAdapter with check boxes.
Well this is a simple question i want to filter two elements sorted reverse
I have a huge table and I want simple sorting. It could be so
I want a simple form with one text box and a submit button. For
I want a simple sign in app in which a user logins successfully if
I want to develop simple HTTP filter (transparent proxy). I want it to support
I just wrote a simple DirectShow Filter (which inherits from CTransformFilter). But I want
How can I build a simple table filter with good effect using jQuery? I
I want a simple TextView to behave the way simple_list_item_1 in a ListView does.
I want a simple effect of slide up and down. I'm new to jquery

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.