Values to not toggle off when accessed via <iron-form> .serialize() method.
Closed this issue · 1 comments
maria-le commented
<iron-form>.serialize()
method returns <paper-toggle-button>
values "on"
when user toggles to "off"
.
Expected outcome
<iron-form>.serialize() == {"foo":"off"}
Actual outcome
<iron-form>.serialize() == {"foo":"on"}
Steps to reproduce
See this Stack Overflow question.
Demo
bicknellr commented
Fixed by PolymerElements/iron-form#82 and PolymerElements/iron-checked-element-behavior#11.
@maria-le: To more closely emulate the behavior of checkboxes during form submission, they're now excluded if they aren't checked (rather than having value "off"
). Also, note that native checkboxes' value attributes are in 'default/on' mode. So, even if the checkbox isn't checked, accessing the value
property will either return what the value
attribute it set to, or "on"
, if the value
attribute is not set.