Forum Moderators: open

Message Too Old, No Replies

Radio button and checkbox

How do you deal with them?

         

tomda

11:30 am on Mar 29, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Well,

I know that radio button and checkbox can not be changed using style (except the border color and thickness).

The checkbox are much too big for my current layout.
So I have tried to use radio button : the size is OK but because my radio buttons have a different name (to allow multiple choices), I can CHECK them individually but I can not UNCHECK them individually.

Is there a way to reduce the size of checkbox or to uncheck independant radio button on second click?

Thanks

aeve

3:35 pm on Mar 29, 2004 (gmt 0)

10+ Year Member



The general wisdom that I've picked up is that it's probably not a good idea to mess around too much with the styling and especially the functionality of form controls. People have expectations for what forms should look like and how they should behave, so if you change things too much, your form will get a lot of weird and not so useful data -- if it gets any at all.

That said, I don't think it would be too hard to write a javascript that onclick of a radio button rewrote it's checked attribute (though I've never tried it.)

Adam

R1chard

3:41 pm on Mar 30, 2004 (gmt 0)

10+ Year Member



Well, you can change both the foreground and the background colors for both, and the borders, and even the appearence in the hover state...

I think in some browsers the box size is related to the font size... Or maybe even to graphics in a user-installed browser theme or skin. Like with scrollbars, it's not really a webmaster's job to alter stuff like that. It might even be difficult for some people to see...

Anyhow, I'm pretty sure Flash is capable of this, but I guess that doesn't interest you.

But still, it's not a good idea to interchange these two different elements and then hack the behavior. It's as bad as using blockquote just because the indent looks nice.

treeline

2:06 pm on Apr 5, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What if you'd like to change the amount of space around radio buttons or check boxes? That is, use the original elements for visitor familiarity, but change the vertical and horizontal spacing around them to fit into a design. Is there a way to do this?

Brett_Tabke

2:12 pm on Apr 5, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



just remember that more-than-likely, css applied to forms is not going to be a universal solution. You will have various problems in just about every browser available.

brucec

6:34 pm on Apr 5, 2004 (gmt 0)

10+ Year Member



You can easily control checkboxes by including them in either
1. A table and formatting the table

or

2. Enclosing them in <DIV> tag formatting the <DIV>