Radio button group

Discussion in 'Javascript' started by ahixon2112, Apr 18, 2007.

  1. ahixon2112

    ahixon2112 Guest

    I have a form that contains two radio buttons each with a drop down
    list attached. As the form loads, I have the following javascript that
    runs after the drop down lists populate with items from a database:

    <script language="javascript">
    this.form.ManagementCheck[0].checked=false;
    this.form.ManagementCheck[1].checked=false;
    if (this.form['Manager'].selectedIndex != 0)
    {this.form.ManagementCheck[0].checked=true};
    if (this.form['Director'].selectedIndex != 0)
    {this.form.ManagementCheck[1].checked=true};
    </script>

    I also have some code up above this (ColdFusion) that sets one of the
    list items to selected if that particular field is populated in the
    database and matches an item from the list. So, I would like for the
    radio button that's beside it's respective drop down list to become
    checked if the selectedIndex of that list is not 0, but I can't get it
    to be consistent. Once a radio button is selected, it will not change
    no matter which list has an item selected.

    Any thoughts?
     
    ahixon2112, Apr 18, 2007
    #1
    1. Advertisements

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

    Radio Button Group

    Ken Saganowski, Jan 23, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    704
    Alvin Bruney [MVP]
    Jan 25, 2004
  2. David Hearn
    Replies:
    0
    Views:
    681
    David Hearn
    Mar 4, 2005
  3. Replies:
    1
    Views:
    4,104
    John C. Bollinger
    Feb 24, 2006
  4. Rick
    Replies:
    1
    Views:
    4,451
    Victor Bazarov
    May 7, 2004
  5. Scott D Johnson
    Replies:
    1
    Views:
    1,372
    Scott D Johnson
    Sep 27, 2006
  6. M. Ali Qureshi

    Validator for radio button group

    M. Ali Qureshi, Dec 10, 2007, in forum: ASP .Net
    Replies:
    1
    Views:
    395
    bruce barker
    Dec 10, 2007
  7. Replies:
    1
    Views:
    2,703
    Nathan Sokalski
    Dec 12, 2008
  8. Hiten
    Replies:
    1
    Views:
    932
    Vidar Petursson
    May 26, 2004
Loading...