-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve error handling in forms (#52)
* Update dependencies * Create Makefile * Add error handling * Improved error handling in forms * Update test
- Loading branch information
Showing
9 changed files
with
225 additions
and
186 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
runserver: | ||
poetry run python manage.py runserver 8765 |
7 changes: 7 additions & 0 deletions
7
dsfr/templates/dsfr/form_field_snippets/checkbox_snippet.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 17 additions & 15 deletions
32
dsfr/templates/dsfr/form_field_snippets/checkboxselectmultiple_snippet.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,21 @@ | ||
{% load widget_tweaks %} | ||
<div class="fr-form-group{% if field.errors %} fr-form-group--error{% endif %}{% if field.field.disabled %} fr-form-group--disabled{% endif %}"> | ||
<fieldset class="fr-fieldset"> | ||
<legend class="fr-fieldset__legend fr-text--regular" id="checkboxes-legend-{{ field.auto_id }}"> | ||
{{ field.label_tag }}{% if field.field.required %} *{% endif %} | ||
{% if field.help_text %}<span class="fr-hint-text">{{ field.help_text }}</span>{% endif %} | ||
</legend> | ||
<fieldset class="fr-fieldset{% if field.errors %} fr-fieldset--error{% endif %}" id="checkboxes-{{ field.auto_id }}" aria-labelledby="{{ field.auto_id }}-legend{% if field.errors %} {{ field.auto_id }}-messages{% endif %}"> | ||
<legend class="fr-fieldset__legend fr-text--regular" id="{{ field.auto_id }}-legend"> | ||
{{ field.label_tag }}{% if field.field.required %} *{% endif %} | ||
{% if field.help_text %}<span class="fr-hint-text">{{ field.help_text }}</span>{% endif %} | ||
</legend> | ||
|
||
<div class="fr-fieldset__content"> | ||
<div class="fr-fieldset__content"> | ||
{% if field.field.disabled %} | ||
{{ field|attr:"disabled" }} | ||
{% else %} | ||
{{ field }} | ||
</div> | ||
|
||
{% if field.errors %} | ||
<div id="{{ field.auto_id }}-desc-error" class="fr-error-text"> | ||
{{ field.errors }} | ||
</div> | ||
{% endif %} | ||
</fieldset> | ||
</div> | ||
</div> | ||
|
||
{% if field.errors %} | ||
<div id="{{ field.auto_id }}-messages" class="fr-error-text"> | ||
{{ field.errors }} | ||
</div> | ||
{% endif %} | ||
</fieldset> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 18 additions & 15 deletions
33
dsfr/templates/dsfr/form_field_snippets/radioselect_snippet.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,22 @@ | ||
{% load widget_tweaks %} | ||
<div class="fr-form-group{% if field.errors %} fr-form-group--error{% endif %}{% if field.field.disabled %} fr-form-group--disabled{% endif %}"> | ||
<fieldset class="fr-fieldset"> | ||
<legend class="fr-fieldset__legend fr-text--regular" id="radio-legend-{{ field.auto_id }}"> | ||
{{ field.label_tag }}{% if field.field.required %} *{% endif %} | ||
{% if field.help_text %}<span class="fr-hint-text">{{ field.help_text }}</span>{% endif %} | ||
</legend> | ||
<fieldset class="fr-fieldset{% if field.errors %} fr-fieldset--error{% endif %}" id="radio-{{ field.auto_id }}" aria-labelledby="{{ field.auto_id }}-legend{% if field.errors %} {{ field.auto_id }}-messages{% endif %}"> | ||
<legend class="fr-fieldset__legend fr-text--regular" id="{{ field.auto_id }}-legend"> | ||
{{ field.label_tag }}{% if field.field.required %} *{% endif %} | ||
{% if field.help_text %}<span class="fr-hint-text">{{ field.help_text }}</span>{% endif %} | ||
</legend> | ||
|
||
<div class="fr-fieldset__content"> | ||
{{ field|add_class:"fr-radio-group" }} | ||
</div> | ||
<div class="fr-fieldset__content"> | ||
{% if field.field.disabled %} | ||
{{ field|add_class:"fr-radio-group"|attr:"disabled" }} | ||
{% else %} | ||
{{ field|add_class:"fr-radio-group" }} | ||
{% endif %} | ||
</div> | ||
|
||
{% if field.errors %} | ||
<div id="{{ field.auto_id }}-desc-error" class="fr-error-text"> | ||
{% if field.errors %} | ||
<div class="fr-messages-group fr-error-text" id="{{ field.auto_id }}-messages"> | ||
{{ field.errors }} | ||
</div> | ||
{% endif %} | ||
</fieldset> | ||
</div> | ||
</div> | ||
{% endif %} | ||
</fieldset> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.