Skip to content

Commit

Permalink
cms_form: fix master/slave js handle required
Browse files Browse the repository at this point in the history
The field wrapper should toggle the required class.
  • Loading branch information
simahawk committed Oct 31, 2023
1 parent 767c7bc commit 2e619f9
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions cms_form/static/src/js/master_slave.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,16 @@ odoo.define("cms_form.master_slave", function (require) {
.removeClass("disabled");
},
handle_required: function (slave_fname) {
$('[name="' + slave_fname + '"]').attr("required", "required");
$('[name="' + slave_fname + '"]')
.attr("required", "required")
.closest(".form-group")
.addClass("field-required");
},
handle_no_required: function (slave_fname) {
$('[name="' + slave_fname + '"]').attr("required", null);
$('[name="' + slave_fname + '"]')
.attr("required", null)
.closest(".form-group")
.removeClass("field-required");
},
});
});

0 comments on commit 2e619f9

Please sign in to comment.