[Form] `get values` behavior does not return logical value
<div class="ui form">
<div class="field">
<div class="ui radio checkbox">
<input type="radio" name="r1" value="0" checked>
<label>Zero</label>
</div>
<div class="ui radio checkbox">
<input type="radio" name="r1" value="1">
<label>One</label>
</div>
</div>
<div class="field">
<div class="ui checkbox">
<input type="checkbox" name="c1" checked>
<label>Check</label>
</div>
</div>
</div>
$('.ui.checkbox').checkbox();
console.log($('.ui.form').form('get values'));
$('input[name="r1"]').val('1');
$('input[name="c1"]').parent().checkbox('set unchecked');
console.log($('.ui.form').form('get values'));
Actual Result
Object { r1: false, c1: "on" }
Object { r1: "1", c1: false }
Expected Result
Object { r1: "0", c1:true }
Object { r1: "1", c1: false }
or
Object { r1: "0", c1:1 }
Object { r1: "1", c1: 0 }
Version
2.4.0
Testcase
http://jsfiddle.net/4eghqcrv/
I find the same trouble.
“get values” returned "on" and false. but "set values" will not treat "on" as true...
The radio value ("0" instead of false) was fixed in the community fork Fomantic-UI by https://github.com/fomantic/Fomantic-UI/pull/1328 See your adjusted jsfiddle here http://jsfiddle.net/lubber/gjLbqz5p/
However, providing the value for the checkbox is intented because you can specify a custom value for a checkbox input field and implemented by https://github.com/Semantic-Org/Semantic-UI/pull/2979
Related issue https://github.com/Semantic-Org/Semantic-UI/issues/2954
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-value
The radio value ("0" instead of false) was fixed in the community fork Fomantic-UI by fomantic/Fomantic-UI#1328 See your adjusted jsfiddle here http://jsfiddle.net/lubber/gjLbqz5p/
However, providing the value for the checkbox is intented because you can specify a custom value for a checkbox input field and implemented by #2979
Related issue #2954
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-value
The unacceptable thing is the difference between "set vaules" and "get values".
@landall I prepared a PR to also support "on" as a trigger to check the checkbox in the community fork Fomantic-UI by https://github.com/fomantic/Fomantic-UI/pull/2077