I want to show my result from the form in the table on the same page.
//my form
function find_tryk_filter_test_form_page($form, &$form_state)
{
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Find trykluft element'),
'#ajax' => array(
'callback' => 'find_tryk_filter_test_ajax_result_callback',
'wrapper' => 'result-wrapper',
'method' => 'click'
)
);
return $form;
}
My page callback function
function find_tryk_filter_test_page()
{
$page = drupal_render(drupal_get_form('find_tryk_filter_test_form_page'));
$page .= filter_elementer_rows($form_state['values']['dropdown_third']);
print_r($page);
return $page;
}
The function that retrives my data and create the table
function filter_elementer_rows($value_dropdown_third)
{
$header = array(
'Navn',
'Shoplink',
'Brochure'
);
$query = db_query(//Some sql statement...));
$rows = array();
foreach ($query as $row) {
$rows[] = array(
$row->title,
$row->field_shoplink_value,
$row->uri
);
}
return theme('table', array(
'header' => $header,
'rows' => $rows
));
}
My submit function
function find_tryk_filter_test_page_submit($form, &$form_state)
{
return find_tryk_filter_test_page();
}
My problem is that when I run this, I get absolutely nothing in the table. And the SQL does work. Do I miss anything?