0

In Bootstrap there is a nice horizontal form option. But in Drupal + Bootstrap base theme I couldn't find any ways to use this horizontal forms and layout form elements as it described, eg. col-2 for labels and col-10 for inputs.

The only way I found is Strapped theme (https://www.drupal.org/project/strapped) but it is in dev stage and I don't need one more base theme.

Bootstrap is so popular along with horizontal forms and I don't want to believe there is no way to solve this problem.

Or everybody uses hook_form_alter() and render horizontal form somehow in code?

Thanks in advance.

1
  • Using hook_form_alter() is the only way I can think of. I can't find module out of the box.
    – Jimmy Ko
    Commented Nov 3, 2016 at 10:14

1 Answer 1

-1

Can you paste an example here with the code that didn't work for you?

Did you respect the structure below?

<div class="form-group form-item form-item-example-input form-type-textfield"> 
  <label for="edit-example-input" class="control-label col-md-2">Enter long URL: </label>
  <div class="col-md-10">
    <input type="text" maxlength="100" size="60" value="http://" name="example_input" id="edit-example-input" class="form-control col-md-10 form-text" tabindex="1">
  </div>
</div>
7
  • This example works, of course. I have seen it. But my question is there any UI to manage forms to be rendered as horizontal or inline or vertical. Commented Nov 3, 2016 at 12:37
  • 1. For sure, you can use CSS.
    – OPTASY
    Commented Nov 3, 2016 at 12:41
  • 2. You can use hook_form_alter() as you said. 3. You can try a module like drupal.org/project/arrange_fields if it is more simple for you.
    – OPTASY
    Commented Nov 3, 2016 at 12:42
  • In Drupal Bootstrap theme settings there is no choice of form type. And by default Bootstrap theme rendering form without classes .form-inline or .form-horizontal. How can we use these classes without hook_form_alter()? Commented Nov 3, 2016 at 12:48
  • I just imagine if there will be an option in theme settings or for each form to select form type. And Bootstrap theme render it automaticaly inline or in grid. Commented Nov 3, 2016 at 12:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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