-
Notifications
You must be signed in to change notification settings - Fork 163
Closed
Labels
Milestone
Description
Bootstrap 4 made changes to the validation messages from Bootstrap 3. The migration guide notes:
- Replaced
.has-error,.has-warning, and.has-successclasses with HTML5 form validation via CSS’s:invalidand:validpseudo-classes.
For Deform this means:
- Change default
error_classfromerrortoinvalid-feedback. - Add a class
is-invalidto the HTML input. Note that both this and the previous must be done jointly in order for the error message to appear. - Replace a few instances of
has-errorwithis-invalid. - Replace a few instances of
<p class="help-block"with<div class="form-text invalid-feedback"as well as the closing tag. See https://getbootstrap.com/docs/4.5/components/forms/#help-text - Update tests in both Deform and deformdemo to detect the proper CSS class.
Examples
deform/templates/mapping_item.pt
class="form-group ${field.error and 'is-invalid' or ''} ${field.widget.item_css_class or ''} ${field.default_item_css_class()}"
...
<div class="invalid-feedback"
...
</div>
deform/templates/textinput.pt
error_class error_class|field.widget.error_class;
...
tal:attributes="class string: form-control ${css_class or ''} ${field.error and error_class or ''};
See also https://getbootstrap.com/docs/4.5/components/forms/?#validation, and in particular https://getbootstrap.com/docs/4.5/components/forms/?#server-side