Skip to content

Commit ee4b535

Browse files
committed
docs: add section to readme
1 parent 40cf5df commit ee4b535

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

‎README.md‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1614,6 +1614,29 @@ This generates:
16141614
</form>
16151615
```
16161616

1617+
Additional options will be passed on as attributes to the root `div`:
1618+
1619+
```erb
1620+
<%= bootstrap_form_for @user_with_error do |f| %>
1621+
<%= f.alert_message "Please fix the errors below.", tabindex: -1, role: "note" %>
1622+
<% end %>
1623+
```
1624+
1625+
This generates:
1626+
1627+
```html
1628+
<form accept-charset="UTF-8" action="/users" class="new_user" id="new_user" method="post">
1629+
<div class="alert alert-danger" tabindex="-1" role="note">
1630+
<p>Please fix the errors below.</p>
1631+
<ul class="rails-bootstrap-forms-error-summary">
1632+
<li>Email is invalid</li>
1633+
<li>Misc is invalid</li>
1634+
<li>Preferences is invalid</li>
1635+
</ul>
1636+
</div>
1637+
</form>
1638+
```
1639+
16171640
To output a simple unordered list of errors, use the `error_summary` helper.
16181641

16191642
![Example 51](demo/doc/screenshots/bootstrap/readme/51_example.png "Example 51")

0 commit comments

Comments
 (0)