Making a SELECT unsuccessful

A

August Karlstrom

Hi,

Does anyone know if there is a way to make all options in a SELECT
element become unsuccessful so it behaves like a group of radio buttons
in which no button is checked?


August
 
S

SAZ

Hi,

Does anyone know if there is a way to make all options in a SELECT
element become unsuccessful so it behaves like a group of radio buttons
in which no button is checked?


August

Am I the only one that is thoroughly confused by this question?

Please restate your question in a different form, I have no idea what
you are trying to achieve.
 
J

Jukka K. Korpela

SAZ said:
Hi,

Does anyone know if there is a way to make all options in a SELECT
element become unsuccessful so it behaves like a group of radio
buttons in which no button is checked?
[...]
Am I the only one that is thoroughly confused by this question?

Probably not.
Please restate your question in a different form, I have no idea what
you are trying to achieve.

It's always a good idea to explain what you are trying to achieve, rather
than an assumed technical solution to an unspecified problem, especially
when the assumed solution is a dead end.

However, my crystal ball whispered to me that August was trying to ask "Is
it possible to have a SELECT element where no option has been pre-selected".
The answer is "No, not in any reliable manner, but if you just don't use the
SELECTED attribute, then most browsers behave that way." The good question
then is: Why would you rely on that?
 
R

richard

SAZ said:
Hi,

Does anyone know if there is a way to make all options in a SELECT
element become unsuccessful so it behaves like a group of radio
buttons in which no button is checked?
[...]
Am I the only one that is thoroughly confused by this question?

Probably not.
Please restate your question in a different form, I have no idea what
you are trying to achieve.

It's always a good idea to explain what you are trying to achieve, rather
than an assumed technical solution to an unspecified problem, especially
when the assumed solution is a dead end.

However, my crystal ball whispered to me that August was trying to ask "Is
it possible to have a SELECT element where no option has been pre-selected".
The answer is "No, not in any reliable manner, but if you just don't use the
SELECTED attribute, then most browsers behave that way." The good question
then is: Why would you rely on that?

If the value of a button is either "on" or "off", then all that is
necessary is to make the value of all buttons "off".
Or could it not be possible to have one button "hidden"?
 
R

rf

richard said:
SAZ said:
Hi,

Does anyone know if there is a way to make all options in a SELECT
element become unsuccessful so it behaves like a group of radio
buttons in which no button is checked? [...]
Am I the only one that is thoroughly confused by this question?

Probably not.
Please restate your question in a different form, I have no idea what
you are trying to achieve.

It's always a good idea to explain what you are trying to achieve, rather
than an assumed technical solution to an unspecified problem, especially
when the assumed solution is a dead end.

However, my crystal ball whispered to me that August was trying to ask "Is
it possible to have a SELECT element where no option has been
pre-selected".
The answer is "No, not in any reliable manner, but if you just don't use
the
SELECTED attribute, then most browsers behave that way." The good question
then is: Why would you rely on that?

If the value of a button is either "on" or "off", then all that is
necessary is to make the value of all buttons "off".
Or could it not be possible to have one button "hidden"?

What do buttons have to do with select and option elements?
 
B

bgold12

Hi,

Does anyone know if there is a way to make all options in a SELECT
element become unsuccessful so it behaves like a group of radio buttons
in which no button is checked?

August

If I'm understanding you correctly, you want to create a <select>
element where all the <option>s are unselected. As far as I know,
there's no way to do this; there must always be one option selected in
the list. I think what people normally do is have one blank (or
"fake") option, which can be treated as the default. Then none of the
"actual" options will be selected.

bgold12
 
A

August Karlstrom

August said:
Hi,

Does anyone know if there is a way to make all options in a SELECT
element become unsuccessful so it behaves like a group of radio buttons
in which no button is checked?

Apparently my question was not so clearly stated.

The term "successful control" is used by W3C to mean a control for which
a name/value pair is submitted. With this terminology an unchecked radio
button will become unsuccessful when the form it belongs to is submitted.

Ideally I think you should be able to change a choice made through radio
buttons to a drop-down list (or vise versa) without changing the program
which processes the submitted form (a kind of view-controller
independence). However, since at least one option in a SELECT element
will always be selected it will also be submitted.

Unless I am wrong I think I have answered my own question, i.e. it is
not possible.


August
 
K

Kiran Makam

You can make any form controls "unsuccessful" by don't giving it a
"name". If name attribute is not available that control will not get
submitted. For your scripting needs you can use the id attribute.

Form controls can also be made unsuccessful by disabling them.

- Kiran Makam
 
K

Kiran Makam

You can make any form control "unsuccessful" by not giving a "name".
If name attribute is not available that control will not get
submitted. For your scripting needs you can use the id attribute.

Form controls can also be made unsuccessful by disabling them.

- Kiran Makam
 
A

August Karlstrom

Kiran said:
You can make any form control "unsuccessful" by not giving a "name".

An option in a SELECT element do not have a name in the first place and
radio buttons are grouped by name so that will not work.
If name attribute is not available that control will not get
submitted. For your scripting needs you can use the id attribute.

Form controls can also be made unsuccessful by disabling them.

That might be an option though (or maybe more of a "hack" in this case).

By the way, I have learned that, as with SELECT options, at least one
radio buttons must always be checked.


August
 
J

Jonathan N. Little

August said:
By the way, I have learned that, as with SELECT options, at least one
radio buttons must always be checked.

Correct. To OP, the proper way to handle this is with your receiving
script. You *may* use JavaScript to pre-check the value before
submitting the form, but as it has been said countless times "Do not
rely on JavaScript for validation" the final validation is *always* done
on the server.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top