Results 1 to 2 of 2

Thread: Form Using Radio Buttons to Redirect

  1. #1
    Join Date
    Jul 2010
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Form Using Radio Buttons to Redirect

    Hi,
    I am trying to create a form that has four questions and the user can select their answer from radio buttons. Depending on their answers, when they hit submit, they are redirected to a new page. Please help! Im new to JS and apologize if my code looks really bad.

    Thanks in advance!

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Supply Chain Goods Test</title>
    <script type="text/javascript">


    function whereTo () {
    if ((Goods==true) && (Direct==true) && (SoleSource==true))
    { window.location = "http://www.somesite/page1"; }

    if ((Goods==true) && (Direct==true) && (NetworkID==true) && (Competed==true))
    { window.location = "http://www.somesite/page2"; }

    if ((Goods==true) && (Indirect==true) && (CostCenter==true) && (SoleSource==true))
    { window.location = "http://www.somesite/page3"; }

    if ((Goods==true) && (Direct==true) && (NetworkID==true) && (SoleSource==true))
    { window.location = "http://www.somesite/page4"; }

    if ((Goods==true) && (Indirect==true) && (CostCenter==true) && (Competed==true))
    { window.location = "http://www.somesite/page5"; }

    }

    if(documents.forms['RedirectForm'].good.checked)
    {

    }
    if(documents.forms['RedirectForm'].charge.checked)
    {

    }
    if(documents.forms['RedirectForm'].pay.checked)
    {

    }
    if(documents.forms['RedirectForm'].order.checked)
    {

    }
    </script>
    </head>

    <body>

    <form name="RedirectForm" id="RedirectForm">
    <table cellpadding="0" cellspacing="0">
    <tr>
    <td colspan="2" valign="top"><p>Are you ordering goods or services?</p></td>
    <td colspan="2" align="left" valign="middle">
    <input type="radio" id="Goods" name="good" /> Goods<br />
    <input type="radio" id="Services" name="good" /> Services</td>
    </tr>
    <tr>
    <td colspan="2" bgcolor="#EFEFEF"><p>Is your order for a Direct or Indirect charge?</p></td>
    <td colspan="2" align="left" valign="middle" bgcolor="#EFEFEF">
    <input type="radio" id="Direct" name="charge" /> Direct<br />
    <input type="radio" id="Indirect" name="charge" /> Indirect</td>
    </tr>
    <tr>
    <td width="600">Do you have a cost center or Network ID</td>
    <td align="left" width="150" valign="middle">
    <input type="radio" id="CostCenter" name="pay" /> Cost Center<br />
    <input type="radio" id="NetworkID" name="pay" /> Network ID</td>
    </tr>
    <tr>
    <td height="61" colspan="2"><p>Is your order for a Sole Source or can it be competed?</p></td>
    <td colspan="2" align="left" valign="middle">
    <input type="radio" id="SoleSource" name="order" /> Sole Source<br />
    <input type="radio" id="Competed" name="order" /> Can Be Competed</td>
    </tr>
    <tr>
    <td colspan="2" align="right" valign="middle"><input type="submit" value="Submit" onclick="return whereTo()" /></td>
    </tr>
    </table>

    </form>
    </body>
    </html>

  2. #2
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    So basically a category type quiz I guess Ill put it?

    The majority of a specific category selected gets directed to a page.
    Jeremy | jfein.net

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •