2

I have a quick question. I work with a form that consists of the following:

$form['data_field'] = array(
    '#type' => 'textfield',
    '#title' => t('Killer search engine!'),
    '#id'   => 'killer-search-engine',
    '#maxlength' => 1024,
    '#description' => t('Search by using tags and free text'),
);

$form['submit'] = array(
    '#type' => 'submit',
    '#value' => 'Go!!',
);
...
...
fill $table
...
...
if(sizeof($form_state['input'])!=0) {

    $form['table'] = array (
        '#title' => 'TABLE',
        '#type'   => 'table',
        '#value' => $table,
    );
}
return $form.

The form is appearing but the table element of it, even though it is filled with html code of an actual table(I checked through dpm($form)) does not appear. Anyone with a quick fix?

Thanks beforehand

4

If you want to display the values in table format you can use Table theme
Example:-

$form['table'] = array(
  '#theme' => 'table',
  '#header' => $header,
  '#rows' => $rows,
  '#empty' => t('Empty Rows')
  );

$header and $rows would be arrays.

0

Your Answer

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

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