Skip to content
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

update radio field to use correct b4 classes for validation #159

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions keg_elements/templates/keg_elements/forms/horizontal_b4.html
Original file line number Diff line number Diff line change
Expand Up @@ -192,20 +192,21 @@
{% endif %}
<div class="labeled-group">
{% for value, label, checked in field.iter_choices() %}
<div class="radio">
<label>
<input type="radio"
name="{{ field.id }}"
id="{{ field.id }}"
value="{{ value }}"
{{ 'checked' if checked }}
{{ 'disabled' if field.flags.disabled or (field.flags.readonly and not checked) }}
tabIndex="{{tabIndex}}">
{{ label }}
</label>
{% set input_id = field.id ~ '-' ~ loop.index0 %}
<div class="form-check">
<input type="radio"
name="{{ field.id }}"
id="{{ input_id }}"
class='form-check-input{{' is-invalid' if field.errors }}'
value="{{ value }}"
{{ 'checked' if checked }}
{{ 'disabled' if field.flags.disabled or (field.flags.readonly and not checked) }}
{{ 'required' if field.flags.required }}
tabIndex="{{tabIndex}}">
<label class="form-check-label" for="{{ input_id }}">{{ label }}</label>
{% if loop.last %}{{ field_errors(field) }}{% endif %}
</div>
{% endfor %}
{{ field_errors(field) }}
</div>
{% if field.description %}
{{ description(field) }}
Expand Down