Fixed bug when duplicating option tags (#1716)
This commit is contained in:
parent
60350c6532
commit
1c471acfd5
@ -1,5 +1,11 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 1.7.0.1
|
||||||
|
|
||||||
|
[#1716](https://github.com/yesodweb/yesod/pull/1716)
|
||||||
|
|
||||||
|
* Fixed bug where duplicating `<option>` tags caused the `value` field to be cleared
|
||||||
|
|
||||||
## 1.7.0
|
## 1.7.0
|
||||||
|
|
||||||
[#1707](https://github.com/yesodweb/yesod/pull/1707)
|
[#1707](https://github.com/yesodweb/yesod/pull/1707)
|
||||||
|
|||||||
@ -304,11 +304,14 @@ mhelperMulti field@Field {..} fs@FieldSettings {..} wrapperClass defs minVals Mu
|
|||||||
// input types where we don't want to reset the value
|
// input types where we don't want to reset the value
|
||||||
const keepValueTypes = ["radio", "checkbox", "button"];
|
const keepValueTypes = ["radio", "checkbox", "button"];
|
||||||
|
|
||||||
|
var shouldKeep = keepValueTypes.includes(e.prop('type'))
|
||||||
|
|| e.prop("tagName") == "OPTION";
|
||||||
|
|
||||||
// uncheck any checkboxes or radio fields and empty any text boxes
|
// uncheck any checkboxes or radio fields and empty any text boxes
|
||||||
if(e.prop('checked') == true)
|
if(e.prop('checked') == true)
|
||||||
e.prop('checked', false);
|
e.prop('checked', false);
|
||||||
|
|
||||||
if(!keepValueTypes.includes(e.prop('type')))
|
if(!shouldKeep)
|
||||||
e.val("").trigger("change");
|
e.val("").trigger("change");
|
||||||
// trigger change is to ensure WYSIWYG editors are updated
|
// trigger change is to ensure WYSIWYG editors are updated
|
||||||
// when their hidden code field is cleared
|
// when their hidden code field is cleared
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
name: yesod-form-multi
|
name: yesod-form-multi
|
||||||
version: 1.7.0
|
version: 1.7.0.1
|
||||||
license: MIT
|
license: MIT
|
||||||
license-file: LICENSE
|
license-file: LICENSE
|
||||||
author: James Burton <jamesejburton@gmail.com>
|
author: James Burton <jamesejburton@gmail.com>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user