Support required-if and display-dependency for more elements (#1788)

This commit is contained in:
Felix Rindt
2020-09-28 10:42:03 +02:00
committed by GitHub
parent f3a2d0cb03
commit 2384478b45
2 changed files with 4 additions and 5 deletions

View File

@@ -276,7 +276,7 @@ var form_handlers = function (el) {
dependency.on("change", update);
});
el.find("div[data-display-dependency], textarea[data-display-dependency], input[data-display-dependency]").each(function () {
el.find("div[data-display-dependency], textarea[data-display-dependency], input[data-display-dependency], select[data-display-dependency]").each(function () {
var dependent = $(this),
dependency = $($(this).attr("data-display-dependency")),
update = function (ev) {
@@ -300,7 +300,7 @@ var form_handlers = function (el) {
dependency.closest('.form-group').find('input[name=' + dependency.attr("name") + ']').on("dp.change", update);
});
el.find("input[data-required-if]").each(function () {
el.find("input[data-required-if], select[data-required-if], textarea[data-required-if]").each(function () {
var dependent = $(this),
dependency = $($(this).attr("data-required-if")),
update = function (ev) {

View File

@@ -282,8 +282,7 @@ $(function () {
return true;
});
// Invoice address form
$("input[data-required-if]").each(function () {
$("input[data-required-if], select[data-required-if], textarea[data-required-if]").each(function () {
var dependent = $(this),
dependency = $($(this).attr("data-required-if")),
update = function (ev) {
@@ -298,7 +297,7 @@ $(function () {
dependency.closest('.form-group').find('input[name=' + dependency.attr("name") + ']').on("dp.change", update);
});
$("input[data-display-dependency], div[data-display-dependency]").each(function () {
$("input[data-display-dependency], div[data-display-dependency], select[data-display-dependency], textarea[data-display-dependency]").each(function () {
var dependent = $(this),
dependency = $($(this).attr("data-display-dependency")),
update = function (ev) {