0

i'm working on a problem for a while and still found no answer. I'm using the Webform Plugin to show a contact form on my site.

The current structure is:

<form>
 <div class="form-item">...</div>
 <div class="form-item">...</div>
 <div class="form-item">...</div>
 <div class="form-item">...</div>
</form>

Is it possible, maybe with a hook because i want to apply it to a special form, to get this HTML structure:

<form>
  <div class="pull-left">
     <div class="form-item">...</div>
     <div class="form-item">...</div>
  </div>
  <div class="pull-right">
     <div class="form-item">...</div>
     <div class="form-item">...</div>
  </div>
</form>

I want to split the form items into two rows.

Thanks for hints and tips!

0

Last version of webforms lets you do this outofdabox (put fields in a fieldset though)

You can also achive this using a hook_form_alter implementation (Have not tested this but i think that should work) and using the FAPI #type container element, for example:

$form['left'] = array(
  '#type' => 'container',
  '#attributes' => array(
    'class' => array(
      'left',
      drupal_html_class($class_left),
    ),
    'id' => array('lefttoleft'),
  ),
);      

Create as many container as you want and then move all fields FAPI element inside the container

1
  • Fantastical! :-D
    – cqueiser
    Sep 30 '15 at 19:58

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.