SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast
    Join Date
    Apr 2002
    Posts
    30
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    tricky form action

    I have 5 forms, listed by title on a single page. The way it works now is a user checks a radial button next to the desired form. Once checked, they are taken immediately to that form.

    I don't want it to jump immediately. It should go to the selected form only when the user clicks a separate GO button. How do I program that action into the GO?

  2. #2
    SitePoint Addict Caterwomtious's Avatar
    Join Date
    Dec 2001
    Posts
    222
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hard to say without seeing your code, but the HTML tags for the radio buttons probably have onchange="something" or onclick="something" in them. Find it, and move it to the tag for your Go button instead. It may need adapting, or it may just work.

  3. #3
    SitePoint Enthusiast
    Join Date
    Apr 2002
    Posts
    30
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    tried this ...

    I already tried this. The problem is that the GO button needs to know which radial button was selected first before it can take action and jump to that form.

    Here's the code. For now, the GO button is programmed to do nothing.
    ------------------------------------
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>ContactUsChoices</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <script language="JavaScript" type="text/JavaScript">
    <!--
    function MM_goToURL() { //v3.0
    var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
    for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
    }
    //-->
    </script>
    </head>

    <body>
    <form name="form1" method="post" action="">
    <table width="477" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td width="477" height="44"><font face="Arial, Helvetica, sans-serif"><strong>What
    would you like to Contact us about?</strong></font></td>
    </tr>
    <tr>
    <td height="30"> <table width="99%" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td width="46%" height="32"> <input name="contactchoices" type="radio" onClick="MM_goToURL('parent','contact_us.htm');return document.MM_returnValue" value="general info">
    General Contact Information</td>
    <td colspan="2"><input name="contactchoices" type="radio" onClick="MM_goToURL('parent','techassistform.htm');return document.MM_returnValue" value="techassist">
    Technical Assistance</td>
    </tr>
    <tr>
    <td height="29"> <input name="contactchoices" type="radio" onClick="MM_goToURL('parent','contact_us.htm');return document.MM_returnValue" value="directions">
    Driving Directions</td>
    <td colspan="2"><input name="contactchoices" type="radio" onClick="MM_goToURL('parent','warrantyform.htm');return document.MM_returnValue" value="warranty">
    Warranty Form</td>
    </tr>
    <tr>
    <td height="29"> <input name="contactchoices" type="radio" onClick="MM_goToURL('parent','salesform.htm');return document.MM_returnValue" value="literature">
    Literature Request</td>
    <td colspan="2">&nbsp;</td>
    </tr>
    <tr>
    <td height="31">&nbsp;</td>
    <td colspan="2">&nbsp;</td>
    </tr>
    <tr>
    <td height="31" colspan="2">Click 'GO' after you've made your choice.
    </td>
    <td width="43%"><input type="button" name="Button" value="GO"></td>
    </tr>
    </table></td>
    </tr>
    </table>
    <p>&nbsp;</p>
    </form>
    </body>
    </html>

  4. #4
    HI silver trophy Silverado4x4's Avatar
    Join Date
    Jan 2001
    Location
    USA
    Posts
    953
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Is PHP, ASP, or CGI available?

    You could accomplish that easily with a programming language. Check out the other forums once you find a language you want it in.

  5. #5
    SitePoint Addict Caterwomtious's Avatar
    Join Date
    Dec 2001
    Posts
    222
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Silverado's right - this would be better done with server-side code, or even simple HTML links. Why? Because the moment anyone comes along with Javascript unavailable or turned off, they can't contact you.

    Having said that, this works:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>ContactUsChoices</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <script language="JavaScript" type="text/JavaScript">
    <!--
    function go_to_page(oForm)
    {
    for (var i = 0; i < oForm.elements.length; i++)
    {
    if (oForm.elements[i].checked == true)
    {
    document.location.href = oForm.elements[i].value + '.htm';
    return false;
    break;
    }
    }
    }
    //-->
    </script>
    </head>

    <body>
    <form name="form1" method="post" action="" onsubmit="return go_to_page(this)">
    <table width="477" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td width="477" height="44"><font face="Arial, Helvetica, sans-serif"><strong>What
    would you like to Contact us about?</strong></font></td>
    </tr>
    <tr>
    <td height="30"> <table width="99%" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td width="46%" height="32"> <input name="contactchoices" id="choice1" type="radio" value="contact_us" />
    <label for="choice1">General Contact Information</label></td>
    <td colspan="2"><input name="contactchoices" id="choice2" type="radio" value="techassistform" />
    <label for="choice2">Technical Assistance</label></td>
    </tr>
    <tr>
    <td height="29"> <input name="contactchoices" id="choice3" type="radio" value="contact_us" />
    <label for="choice3">Driving Directions</label></td>
    <td colspan="2"><input name="contactchoices" id="choice4" type="radio" value="warrantyform" />
    <label for="choice4">Warranty Form</label></td>
    </tr>
    <tr>
    <td height="29"> <input name="contactchoices" id="choice5" type="radio" value="salesform" />
    <label for="choice5">Literature Request</label></td>
    <td colspan="2"> </td>
    </tr>
    <tr>
    <td height="31"> </td>
    <td colspan="2"> </td>
    </tr>
    <tr>
    <td height="31" colspan="2">Click 'GO' after you've made your choice.
    </td>
    <td width="43%"><input type="submit" name="Button" value="GO"></td>
    </tr>
    </table></td>
    </tr>
    </table>
    <p> </p>
    </form>
    </body>
    </html>


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
  •