Correzione set JS per checkbox disabilitati
This commit is contained in:
parent
aae183c177
commit
466322ba54
|
@ -287,8 +287,6 @@ Input.prototype.get = function () {
|
||||||
* @returns {Input}
|
* @returns {Input}
|
||||||
*/
|
*/
|
||||||
Input.prototype.set = function (value) {
|
Input.prototype.set = function (value) {
|
||||||
const previous = this.get();
|
|
||||||
|
|
||||||
// Gestione dei valori per l'editor
|
// Gestione dei valori per l'editor
|
||||||
if (this.element.hasClass("editor-input") && typeof CKEDITOR !== 'undefined') {
|
if (this.element.hasClass("editor-input") && typeof CKEDITOR !== 'undefined') {
|
||||||
const name = this.element.attr("id");
|
const name = this.element.attr("id");
|
||||||
|
@ -298,9 +296,10 @@ Input.prototype.set = function (value) {
|
||||||
|
|
||||||
// Impostazione valore per checkbox
|
// Impostazione valore per checkbox
|
||||||
let group = this.element.closest(".form-group");
|
let group = this.element.closest(".form-group");
|
||||||
const checkbox = group.find("input[type=checkbox]");
|
if (group.find("input[type=checkbox]").length) {
|
||||||
if (checkbox.length && parseInt(value) !== previous) {
|
value = value === true || parseInt(value) !== 1;
|
||||||
checkbox.click();
|
group.find("[type=hidden]").val(+value).trigger('change')
|
||||||
|
group.find("[type=checkbox]").prop("checked", value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue