Skip to content

Commit 5cac1fa

Browse files
authored
fix(api): reset existing formdata for proper renewing
The apis formData collections always extended an already existing data value. If this however already contained properties of the same names as the formfields those were extended as well. This led into situations where you want to reuse the same api several times. Especially for multiple name form fields like dropdown those always kept the previous values when submitted multiple times
1 parent 8cafd4c commit 5cac1fa

File tree

1 file changed

+3
-0
lines changed
  • src/definitions/behaviors

1 file changed

+3
-0
lines changed

src/definitions/behaviors/api.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,9 @@ $.api = $.fn.api = function(parameters) {
443443
} else {
444444
formData[element.name] = element.value;
445445
}
446+
if(hasOtherData && data[element.name]) {
447+
delete data[element.name];
448+
}
446449
});
447450

448451
if(hasOtherData) {

0 commit comments

Comments
 (0)