When using radio with form attribute Topic is solved

The place to report Pale Moon specific bugs on the Windows operating system.

Moderator: satrow

Post Reply
User avatar
rerere
Newbie
Newbie
Posts: 4
Joined: 2019-12-02, 02:33

When using radio with form attribute

Post by rerere » 2019-12-02, 02:46

When using both of radio with form attribute and radio without form attribute,
value of radio with form attribute is affected by radio without form attribute.
But, sending value dose not include radio without form attribute.

Code: Select all

<label>1
<input form="a" type="radio" name="radio" value="1" checked id="radio1">
</label>
<label>2
<input form="a" type="radio" name="radio" value="2">
</label>

<form id="a" method='post'>
<label>3
<input form="" type="radio" name="radio" value="3">
</label>
<input type='submit'>
</form>
https://jsfiddle.net/htf7z3px/

1, 2: radio with form attribute
3: radio without form attribute

When click "3", "1" radio became unchecked.
But, posted value does not include key of "radio".

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 25002
Joined: 2011-08-28, 17:27
Location: 58°2'16"N 14°58'31"E
Contact:

Re: When using radio with form attribute

Post by Moonchild » 2019-12-02, 07:37

This is not a bug in the browser. If you explicitly clear the form name then the input will not be part of the form (and thus not submitted).
Any radio with the same name attrribute will be part of the same radio group, per definition.

Please go back to school on how to use radio controls.
"If you want to build a better world for yourself, you have to be willing to build one for everybody." -- Coyote Osborne
Image

User avatar
rerere
Newbie
Newbie
Posts: 4
Joined: 2019-12-02, 02:33

Re: When using radio with form attribute

Post by rerere » 2019-12-02, 10:18

The same radio group?
Although two elements was checked after click "3" and "1"?
https://imgur.com/9APT2gA

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 25002
Joined: 2011-08-28, 17:27
Location: 58°2'16"N 14°58'31"E
Contact:

Re: When using radio with form attribute

Post by Moonchild » 2019-12-02, 12:38

Yes the same radio group. You give it the same name, then it's the same group.
"If you want to build a better world for yourself, you have to be willing to build one for everybody." -- Coyote Osborne
Image

User avatar
rerere
Newbie
Newbie
Posts: 4
Joined: 2019-12-02, 02:33

Re: When using radio with form attribute

Post by rerere » 2019-12-03, 00:59

Once the radio group is created, selecting any radio button in that group automatically deselects any other selected radio button in the same group.

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 25002
Joined: 2011-08-28, 17:27
Location: 58°2'16"N 14°58'31"E
Contact:

Re: When using radio with form attribute

Post by Moonchild » 2019-12-03, 10:58

"unless you use undefined behavior"
Look at your code. What form does the control in question belong to? Is it part of form "a"?

Just clean up your code. make radios part of the named group and be unambiguous about what form the controls belong to, and you're good.
"If you want to build a better world for yourself, you have to be willing to build one for everybody." -- Coyote Osborne
Image

User avatar
rerere
Newbie
Newbie
Posts: 4
Joined: 2019-12-02, 02:33

Re: When using radio with form attribute

Post by rerere » 2019-12-04, 08:59

OK, this browser is implemented with not specification-based but behavior-based.
Thank you.

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 25002
Joined: 2011-08-28, 17:27
Location: 58°2'16"N 14°58'31"E
Contact:

Re: When using radio with form attribute

Post by Moonchild » 2019-12-04, 09:40

rerere wrote:
2019-12-04, 08:59
OK, this browser is implemented with not specification-based but behavior-based.
Thank you.
If it's a spec compliance issue, then please point me to the relevant spec that addresses this situation.
"If you want to build a better world for yourself, you have to be willing to build one for everybody." -- Coyote Osborne
Image

Post Reply