-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
form layout='inline' does not render inline #96
Comments
Can you elaborate with code, screenshot and perhaps a failing test? The example app shows an inline form that works. |
I am also experiencing this. Inline currently renders with all the form contents wrapped in a Ideally it should not wrap in any div at all in this case. For example, I'm trying to follow the Bootstrap 5 docs for adding a form to the navbar: https://getbootstrap.com/docs/5.2/components/navbar/#supported-content <form class="d-flex ms-auto" role="search" action="" method="GET">
{% load django_bootstrap5 %}
{% bootstrap_form form layout="inline" %}
<button class="btn btn-outline-primary ms-2" type="submit">Search</button>
</form> But instead of outputting the fields directly in the <form class="d-flex ms-auto" role="search" action="" method="GET">
<div class="col-12">
<label class="visually-hidden" for="id_s">Search</label>
<input type="text" name="s" maxlength="255" class="form-control is-valid" placeholder="Search" id="id_s">
</div>
<input type="hidden" name="t" id="id_t">
<button class="btn btn-outline-primary ms-2" type="submit">Search</button>
</form> I believe the "correct" behavior for inline should be to simply output all of the fields without any kind of wrapper divs. |
+1 to this issue. Also experiencing the appearance of this strange |
Thank you for the examples of the resulting code. Can you add the exact code that gives you the wrong result, and please compare to the example app and the tests? |
After digging inside the source code I've found out that this annoying "col-12" field wrapper may be overridden using
This solves the problem with inline layout. |
{% bootstrap_form form layout='inline' show_label=False %}
It looks like inline is not being evaluated correctly.
using layout='horizontal' has the expected render
The text was updated successfully, but these errors were encountered: