Hi,

I am using drupal 4.7 and I have a questions about how to control the form layout, for example:

I would like to create 2 select box that will be displayed one next to the other (and not one under the second), how can I control the layout?

I saw something in the API about these tags:
'#prefix' => '

',
'#suffix' => '

',

so I thought to add html in these 2 tags that contains

and like that to control the layout.
is this the prefered way or I am missing something?

thanks,
Jeremy

Comments

pobster’s picture

You can either;

    $form['conversions']['actions'] = array('#prefix' => '<div class="container-inline">', '#suffix' => '</div>');
    $form['conversions']['actions']['submit'] = array('#type' => 'submit', '#value' => t('Edit'));
    $form['conversions']['actions']['cancel'] = array('#value' => l(t('Cancel'), 'admin/settings/property'));

Or perhaps;

     $form['item'.($count+1)] = array(
        '#type' => 'textfield',
        '#title' => $a,
        '#default_value' => is_array($row[$count]) ? $row[$count]['data'] : $row[$count],
        '#size' => 60,
        '#maxlength' => 255,
        '#description' => $string,
        '#required' => $required,
        '#prefix' => '<table border="1" rules="none"><tr><td>',
        '#suffix' => '</td>',
      );
      $form['link'.($count+1)] = array(
        '#type' => 'textfield',
        '#title' => $a,
        '#default_value' => $link,
        '#size' => 60,
        '#maxlength' => 255,
        '#description' => $string,
        '#required' => $required,
        '#prefix' => '<td>',
        '#suffix' => '</td></tr></table>',
      );

Depends on what you're trying to achieve?

Pobster