Skip to content
Snippets Groups Projects
Commit 4ec28089 authored by qsm-odoo's avatar qsm-odoo
Browse files

[FIX] website: show invalid checkboxes, radio buttons and file upload

Before this commit, when submitting a website form which has invalid
radio buttons, checkboxes or file upload elements, they had no visual
difference. Now they will have red labels as intended with bootstrap.

For alone checkboxes, a warning label will appear after the checkboxes.
This will only take effects for newly added checkboxes.

Related to opw-3003952

Part-of: odoo/odoo#105870
parent 4ea0d545
No related branches found
No related tags found
No related merge requests found
......@@ -418,9 +418,12 @@ odoo.define('website.s_website_form', function (require) {
});
// Update field color if invalid or erroneous
$field.removeClass('o_has_error').find('.form-control, .custom-select').removeClass('is-invalid');
const $controls = $field.find('.form-control, .custom-select, .form-check-input, .form-control-file');
$field.removeClass('o_has_error');
$controls.removeClass('is-invalid');
if (invalid_inputs.length || error_fields[field_name]) {
$field.addClass('o_has_error').find('.form-control, .custom-select').addClass('is-invalid');
$field.addClass('o_has_error');
$controls.addClass('is-invalid');
if (_.isString(error_fields[field_name])) {
$field.popover({content: error_fields[field_name], trigger: 'hover', container: 'body', placement: 'top'});
// update error message and show it.
......
......@@ -72,6 +72,11 @@
display: none;
}
}
.form-control-file.is-invalid {
padding-left: 3px;
border-left: 3px solid $form-feedback-invalid-color;
}
}
body:not(.editor_enable) .s_website_form[data-vcss="001"] {
......
......@@ -246,6 +246,7 @@
t-att-required="field.required || field.modelRequired || None"
t-att-id="field.id"
/>
<span class="invalid-feedback position-absolute"><i class="fa fa-warning"/></span>
</div>
</t>
</t>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment