Making a SELECT unsuccessful

Discussion in 'HTML' started by August Karlstrom, Nov 24, 2008.

  1. 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
     
    August Karlstrom, Nov 24, 2008
    #1
    1. Advertising

  2. August Karlstrom

    SAZ Guest

    In article <ggel2r$jqa$>, says...
    > 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.
     
    SAZ, Nov 24, 2008
    #2
    1. Advertising

  3. SAZ wrote:

    > In article <ggel2r$jqa$>, says...
    >> 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?

    --
    Yucca, http://www.cs.tut.fi/~jkorpela/
     
    Jukka K. Korpela, Nov 24, 2008
    #3
  4. August Karlstrom

    richard Guest

    On Mon, 24 Nov 2008 22:13:34 +0200, "Jukka K. Korpela"
    <> wrote:

    >SAZ wrote:
    >
    >> In article <ggel2r$jqa$>, says...
    >>> 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"?
     
    richard, Nov 25, 2008
    #4
  5. August Karlstrom

    rf Guest

    "richard" <> wrote in message
    news:...
    > On Mon, 24 Nov 2008 22:13:34 +0200, "Jukka K. Korpela"
    > <> wrote:
    >
    >>SAZ wrote:
    >>
    >>> In article <ggel2r$jqa$>, says...
    >>>> 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?
     
    rf, Nov 25, 2008
    #5
  6. August Karlstrom

    bgold12 Guest

    On Nov 24, 11:34 am, August Karlstrom <> wrote:
    > 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
     
    bgold12, Nov 25, 2008
    #6
  7. August Karlstrom wrote:
    > 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
     
    August Karlstrom, Nov 25, 2008
    #7
  8. August Karlstrom

    Kiran Makam Guest

    On Nov 26, 2:10 am, August Karlstrom <> wrote:
    > August Karlstrom wrote:
    > > 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?


    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
     
    Kiran Makam, Nov 26, 2008
    #8
  9. August Karlstrom

    Kiran Makam Guest

    On Nov 26, 2:10 am, August Karlstrom <> wrote:
    > August Karlstrom wrote:
    > > 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?


    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
     
    Kiran Makam, Nov 26, 2008
    #9
  10. Kiran Makam wrote:
    > On Nov 26, 2:10 am, August Karlstrom <> wrote:
    >> August Karlstrom wrote:
    >>> 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?

    >
    > 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
     
    August Karlstrom, Nov 26, 2008
    #10
  11. August Karlstrom wrote:

    >
    > 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.

    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
     
    Jonathan N. Little, Nov 26, 2008
    #11
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?c2FnYXI=?=

    i was unsuccessful in sending email using asp

    =?Utf-8?B?c2FnYXI=?=, Feb 21, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    863
    w66327
    Feb 22, 2005
  2. Stan Goodman
    Replies:
    14
    Views:
    616
    Stan Goodman
    Aug 27, 2005
  3. dcoulic
    Replies:
    0
    Views:
    498
    dcoulic
    Jun 3, 2010
  4. tchangmian
    Replies:
    4
    Views:
    139
    Mark Schupp
    Dec 13, 2004
  5. palmiere
    Replies:
    1
    Views:
    431
    Erwin Moller
    Feb 9, 2004
Loading...

Share This Page