Multiple radio inputs

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • elhombrebala

    #1

    Multiple radio inputs


    With this script I can force the user to select the checkbox befor
    continuing, but now I have a menu with lots of radio unputs and I woul
    like the user to select at least 2 of them; how can I check it?

    <form name=formulario >
    <INPUT type=checkbox name=casilla>
    <INPUT type=button value="Salir"
    onclick="Goingo ut()">
    </form>

    <script>
    function Goingout(){
    if (document.formu lario.casilla.c hecked) window.close()
    else alert("Select this option to continue")
    }
    </script

    elhombrebala
    -----------------------------------------------------------------------
    Posted via http://www.forum4designers.co
    -----------------------------------------------------------------------
    View this thread: http://www.forum4designers.com/message33852.htm

  • Robert

    #2
    Re: Multiple radio inputs

    In article <Guest.106mon@m ail.forum4desig ners.com>,
    elhombrebala <Guest.106mon@m ail.forum4desig ners.com> wrote:
    [color=blue]
    > With this script I can force the user to select the checkbox before
    > continuing, but now I have a menu with lots of radio unputs and I would
    > like the user to select at least 2 of them; how can I check it?
    >[/color]

    <input type="radio" name="BFMS" value="10">

    ....

    if (document.forms[0].BFMS.checked == true)


    A hint.

    Robert

    Comment

    • Dr John Stockton

      #3
      Re: Multiple radio inputs

      JRS: In article <rccharles-A692B9.23003506 022004@news05.w est.earthlink.
      net>, seen in news:comp.lang. javascript, Robert <rccharles@my-deja.com>
      posted at Sat, 7 Feb 2004 03:56:20 :-[color=blue]
      >
      >if (document.forms[0].BFMS.checked == true)
      >[/color]

      AFAICS, the == true serves no useful purpose.

      <URL:http://www.merlyn.demo n.co.uk/js-other.ht#PF> #7

      --
      © John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 IE 4 ©
      <URL:http://jibbering.com/faq/> Jim Ley's FAQ for news:comp.lang. javascript
      <URL:http://www.merlyn.demo n.co.uk/js-index.htm> jscr maths, dates, sources.
      <URL:http://www.merlyn.demo n.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.

      Comment

      • Robert

        #4
        Re: Multiple radio inputs

        elhombrebala <Guest.106mon@m ail.forum4desig ners.com> wrote in message news:<Guest.106 mon@mail.forum4 designers.com>. ..[color=blue]
        > With this script I can force the user to select the checkbox before
        > continuing, but now I have a menu with lots of radio unputs and I would
        > like the user to select at least 2 of them; how can I check it?[/color]

        The typical or intended use of radio buttons is like on an old car
        radio. You put of a group of radio buttons and you are only allowed
        to select on radio button from the group. You make a group by naming
        all the radio buttons the same. This creates an array of radio
        buttons with the same name and you use array indexing to access.

        The general idea of check boxes are for making none, one, or more than
        one selection from the group.

        In you case, your want to force the user to make at least two
        selections. Checkboxes are for this.

        Now, if you have two groupings of radio buttons and you want the user
        to fill have selected a radio button from both this would make sense.
        I use ( ) to indicate a radio button.

        Example:
        Pick a color:
        ( ) red
        ( ) green
        ( ) yellow

        Pick a style of finish:
        ( ) wood
        ( ) metal
        ( ) plastic

        ....
        If I understand what you are proposing, you could be could be
        producing a confusing panel for the user. Try to go with the intend
        of radio and check boxes.

        I hope my minimalistic example was helpful.

        Robert

        PS. == true is easier for me to read. I guess that I could get
        confused over datatypes, but other than that I do not see a problem.
        I guess it could be confusing to a reader who doesn't use == true.

        Comment

        Working...