Fixed bug when duplicating option tags (#1716)

This commit is contained in:
James Burton 2021-01-08 19:03:46 +00:00 committed by GitHub
parent 60350c6532
commit 1c471acfd5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 2 deletions

View File

@ -1,5 +1,11 @@
# 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
[#1707](https://github.com/yesodweb/yesod/pull/1707)

View File

@ -304,11 +304,14 @@ mhelperMulti field@Field {..} fs@FieldSettings {..} wrapperClass defs minVals Mu
// input types where we don't want to reset the value
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
if(e.prop('checked') == true)
e.prop('checked', false);
if(!keepValueTypes.includes(e.prop('type')))
if(!shouldKeep)
e.val("").trigger("change");
// trigger change is to ensure WYSIWYG editors are updated
// when their hidden code field is cleared

View File

@ -1,5 +1,5 @@
name: yesod-form-multi
version: 1.7.0
version: 1.7.0.1
license: MIT
license-file: LICENSE
author: James Burton <jamesejburton@gmail.com>