This commit is contained in:
Ziver Koc 2023-01-06 23:50:33 +01:00
parent 30cfcc7816
commit 4f81b17edc

View file

@ -24,9 +24,7 @@
var button = $(event.relatedTarget); var button = $(event.relatedTarget);
var modal = $(this); var modal = $(this);
// Reset all inputs modal.find(" input, select").val('').change(); // Reset all inputs
if (formTemplateId != null)
modal.find("#" + formTemplateId).empty(); // clear form div
// Set dynamic form data // Set dynamic form data
$.each(button.attr(), function(fieldName, value) { $.each(button.attr(), function(fieldName, value) {
@ -53,10 +51,7 @@
input.parent().prepend("<input type='hidden' name='" + input.prop("name") + "' value='false' />"); input.parent().prepend("<input type='hidden' name='" + input.prop("name") + "' value='false' />");
} }
} else { } else {
input.val(value); input.val(value).change();
if (input.prop("tagName") == "SELECT")
input.change(); // required for select elements to update properly
} }
} }
} }