Element.toQueryString incorrect for created checkboxes in IE #2538

Closed
mrpapercut opened this Issue Nov 13, 2013 · 4 comments

Comments

Projects
None yet
5 participants
@mrpapercut

The value of created element checkbox is not correct when applying .toQueryString in IE.

Example: http://jsfiddle.net/mcwrv/2/

Chrome 30:
Normal checkbox already present in the form: myCheckbox=on
Checkbox added by creating element: myCheckbox=on

IE 10, IE 11
Normal checkbox already present in the form: myCheckbox=on
Checkbox added by creating element: myCheckbox=

@TheShrike

This comment has been minimized.

Show comment Hide comment
@TheShrike

TheShrike Nov 13, 2013

Same problem in IE 9.

IE set the checkbox value="" if not specified; if you set value: 'on' all works in IE too:
http://jsfiddle.net/mcwrv/3/

Same problem in IE 9.

IE set the checkbox value="" if not specified; if you set value: 'on' all works in IE too:
http://jsfiddle.net/mcwrv/3/

@mrpapercut

This comment has been minimized.

Show comment Hide comment
@mrpapercut

mrpapercut Nov 13, 2013

That is indeed a workaround for IE, but not a fix. Especially when the inconsistency shows between created elements via the Element constructor and their predefined HTML equivalents.

The default value of a checkbox should be 'on' if not overwritten (http://www.whatwg.org/specs/web-apps/current-work/#dom-input-value-default-on), and IE is not following the specification on this one on element creation. Mootools should catch it though, or add 'on' as default value when creating a new checkbox.

That is indeed a workaround for IE, but not a fix. Especially when the inconsistency shows between created elements via the Element constructor and their predefined HTML equivalents.

The default value of a checkbox should be 'on' if not overwritten (http://www.whatwg.org/specs/web-apps/current-work/#dom-input-value-default-on), and IE is not following the specification on this one on element creation. Mootools should catch it though, or add 'on' as default value when creating a new checkbox.

@ibolmo ibolmo added this to the 1.5.1 milestone Mar 3, 2014

@arian

This comment has been minimized.

Show comment Hide comment
@arian

arian Mar 23, 2014

Owner

This says the same: http://www.w3.org/TR/html5/forms.html#dom-input-value-default-on

What about radio boxes? If you search this document for default/on you'll find a table which types should have value default to on. So checkboxes and radio buttons.

This property was optional until html5, in html4 it was optional for all input types except checkbox or radio, which is probably why IE is different: http://www.w3.org/TR/html401/interact/forms.html#adef-value-INPUT

Owner

arian commented Mar 23, 2014

This says the same: http://www.w3.org/TR/html5/forms.html#dom-input-value-default-on

What about radio boxes? If you search this document for default/on you'll find a table which types should have value default to on. So checkboxes and radio buttons.

This property was optional until html5, in html4 it was optional for all input types except checkbox or radio, which is probably why IE is different: http://www.w3.org/TR/html401/interact/forms.html#adef-value-INPUT

@SergioCrisostomo

This comment has been minimized.

Show comment Hide comment
@SergioCrisostomo

SergioCrisostomo Mar 23, 2014

Member

@arian nice input. Ok, so radio type also. Would this be a ok solution?

A fiddle with this idea would be like this.

Member

SergioCrisostomo commented Mar 23, 2014

@arian nice input. Ok, so radio type also. Would this be a ok solution?

A fiddle with this idea would be like this.

@SergioCrisostomo SergioCrisostomo added the IE label Mar 24, 2014

@ibolmo ibolmo closed this in #2584 Jul 3, 2014

ibolmo added a commit that referenced this issue Jul 3, 2014

Merge pull request #2584 from SergioCrisostomo/checkbox-newElement-va…
…lue-fix

normalize values on newElement for radio and checkbox types - Fix #2538
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment