Skip to content

Commit

Permalink
Hotfix replace form data (#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
ultmaster authored May 8, 2020
1 parent 49b4930 commit dbb66a0
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions static/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,17 +167,15 @@ function postWithLocalData (button) {

function replaceFormData(form, extra_data) {
for (var val in extra_data) {
if (extra_data.hasOwnProperty(val)) {
var already_exist = form.find('*[name="' + val + '"]');
if (already_exist.length > 0) {
if (already_exist.prop("tagName") == "SELECT") {
already_exist.parent(".ui.dropdown").dropdown("set selected", extra_data[val]);
} else {
already_exist.val(extra_data[val]);
}
var already_exist = form.find('*[name="' + val + '"]');
if (already_exist.length > 0) {
if (already_exist.prop("tagName") == "SELECT") {
already_exist.parent(".ui.dropdown").dropdown("set selected", extra_data[val]);
} else {
form.append("<input type='hidden' name='" + val + "' value='" + extra_data[val] + "'>");
already_exist.val(extra_data[val]);
}
} else {
form.append("<input type='hidden' name='" + val + "' value='" + extra_data[val] + "'>");
}
}
}
Expand Down

0 comments on commit dbb66a0

Please sign in to comment.