[whatwg] New suggestion for mutually exclusive sections in WF2

dolphinling dolphinling at myrealbox.com
Sun Oct 17 14:27:26 PDT 2004


Actually, this suggestion has slightly more scope than just mutually 
exclusive sections, you'll see how in a moment.

This suggestion is for an attribute, which I shall call qwe since I 
can't come up with a good name, which can be applied to a fieldset[1]. 
This attribute is similar to the form attribute--it's value must be the 
value of the id of an input of type checkbox or radio[2] which the 
fieldset is associated with.

If that checkbox or radio button is checked, the fieldset is not 
disabled. If the checkbox or radio button is not checked, the fieldset 
is disabled.

Example:

<form id='dessertform'>

<input type='radio' name='dessert' value='icecream' id='i'>
<label for='i'>Vanilla ice cream</label>

<fieldset qwe='i'>
<input type='checkbox' name='topping' value='chocsause' id='i1'>
<label for='i1'>Chocolate sauce</label>
<input type='checkbox' name='topping' value='carmsause' id='i2'>
<label for='i2'>Caramel sauce</label>
<input type='checkbox' name='topping' value='mcherry' id='i3'>
<label for='i3'>Maraschino cherry</label>
</fieldset>

<input type='radio' name='dessert' value='cake' id='c'>
<label for='c'>Chocolate cake</label>

<fieldset qwe='c'>
<input type='radio' name='icing' value='mint' id='c1'>
<label for='c1'>Mint icing</label>
<input type='radio' name='icing' value='vanilla' id='c2'>
<label for='c2'>Vanilla icing</label>
</fieldset>

</form>

This would present the user with a choice of ice cream or cake, and a 
choice of toppings for their ice cream or icing flavors for their cake.

The other, non-mutually-exclusive-sections way this attribute could be 
used is with a single checkbox, as in:

<form id='moreinfo'>

<input type='checkbox' name='moreinfo' value='moreinfo' id='mi'>
<label for='mi'>Send me more info</label>

<fieldset qwe='mi'>
<label for='email'>Email:</label>
<input type='email' name='email' id='email'>
<p>I like:</p>
<input type='checkbox' name='like' value='basketball' id='bb1'>
<label for='bb1'>Basketball</label>
<input type='checkbox' name='like' value='baseball' id='bb2'>
<label for='bb2'>Baseball</label>
</fieldset>

</form>

If the user checks the box labeled "Send me more info", they're 
presented with a place to input their email and choices on what info to 
recieve.


It would be good to also have a way to make these stylable based on 
whether or not they're disabled. I'm not sure exactly how to do this.


[1] Yes, only a fieldset and not an input. I don't have a good, solid 
reasoning for this, it just seems like the right thing to do.

[2] Only checkboxes and radio buttons. Other input types might be 
possible to implement like text (if there's anything in there, the 
related fieldset becomes not disabled) or email (if there's a valid 
email addres), but their use cases don't make sense.



More information about the whatwg mailing list