From 5071ecdfacfc590f69296d3e2328bce7f57374cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Fri, 5 Nov 2021 14:52:57 +0100 Subject: [PATCH] misc: limit checkbox js prefill to single checkbox field (#58422) --- wcs/qommon/static/js/qommon.forms.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/wcs/qommon/static/js/qommon.forms.js b/wcs/qommon/static/js/qommon.forms.js index d7faf6ff2..e4366e170 100644 --- a/wcs/qommon/static/js/qommon.forms.js +++ b/wcs/qommon/static/js/qommon.forms.js @@ -480,8 +480,10 @@ $(function() { if ($(widget).is('.widget-prefilled') || $(widget).is('.widget-readonly') || data.modified_field == 'user') { // replace text input value $(widget).find('input[type=text], input[type=tel], input[type=numeric], input[type=email], input[type=date], textarea').val(value.content); - // replace checkbox input value - $(widget).find('input[type=checkbox]').prop('checked', value.content); + if ($widget.hasClass('CheckboxWidget')) { + // replace checkbox input value + $widget.find('input[type=checkbox]').prop('checked', value.content); + } } } });