42 users online (2 members and 40 guests)  


  Results 1 to 5 of 5

Related

  1. Radio Buttons Return Nothing    Forum: HTML Forum
    Replies: 7
  2. Labels for radio buttons inside a row    Forum: HTML Forum
    Replies: 11
  3. Replies: 1
  4. Replies: 1
  5. radio buttons    Forum: HTML Forum
    Replies: 2
  1. #1
    scanreg's Avatar
    New User

    Status
    Offline
    Join Date
    Apr 2007
    Posts
    6

    Use combo radio buttons to forward to specific URLs

    My form needs to direct to different URLs depending on a combination of radio button and select box choices

    FORM

    Radio 1
    - A
    - B
    - C

    Select Box 1
    - 1
    - 2
    - 3

    Combo selected and target URL

    A1 - www.fred1.com
    A2 - www.fred2.com
    A3 - www.fred3.com
    B1 - www.fred4.com
    B2 - www.fred5.com
    B3 - www.fred6.com
    C1 - www.fred7.com
    C2 - www.fred8.com
    C3 - www.fred9.com

    /FORM

    Is this doable? How could this be accomplished?

    There is a thread related to one form variable:

    http://www.ahfb2000.com/webmaster_help_desk/showthread.php?t=4703

    But I've never seen code that works with a combination of form variables

    Any help most appreciated. Thanks

  2. #2
    vinyl-junkie's Avatar
    Moderator

    Status
    Offline
    Join Date
    Sep 2005
    Posts
    721

    Re: Use combo radio buttons to forward to specific URLs

    Would a case statement work for you?
    Music Around The World - Collecting tips, trade
    and want lists, album reviews, & more

  3. #3
    scanreg's Avatar
    New User

    Status
    Offline
    Join Date
    Apr 2007
    Posts
    6

    Re: Use combo radio buttons to forward to specific URLs

    Thanks - it looks like the right direction

    How would I combine form elements to get the case feature to work?

    The example deals with one form element selected. What about the A1 type of example above?

    Thanks, again

  4. #4
    vinyl-junkie's Avatar
    Moderator

    Status
    Offline
    Join Date
    Sep 2005
    Posts
    721

    Re: Use combo radio buttons to forward to specific URLs

    I'm not real good with javascript, I can only tell you conceptually how to do it. You supply the code.

    Set a new variable to the selected value from Radio 1 and Select box 1. Something like this:

    Code:
    newvar = Radio1 + SelectBox1;
    Then your case statement would be something like this:

    Code:
    switch (newvar) {
    case 'A1': URL = 'www.fred1.com'; break;
    case 'A2': URL = 'www.fred2.com'; break;
    // etc
    default: URL = 'unknown';
    }
    Music Around The World - Collecting tips, trade
    and want lists, album reviews, & more

  5. #5
    scanreg's Avatar
    New User

    Status
    Offline
    Join Date
    Apr 2007
    Posts
    6

    Re: Use combo radio buttons to forward to specific URLs

    Ah, okay, thanks so much



Tags for this Thread