Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Mar 2006
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Determining form action per value selected

    I was wondering if someone could look at this code and help me out. I am trying to write a conditional statement to determine the action of a form.
    Below is the code. Thank you for your help.

    <html>
    <head>
    <title> </title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <link rel="stylesheet" href="style.css" type="text/css">

    <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
    <%
    Function GetAction()
    If primaryinsurance = "bcbs","nobbs","nobbspos" Then
    GetAction = "presert.asp"
    Else Then
    GetAction = "nopresert.asp"
    End If
    End Function
    %>


    </head>

    <body bgcolor="#FFFFFF" text="#000000" topmargin="0" leftmargin="0">
    <table width="100%" border="0" cellspacing="0" cellpadding="0" class="body">
    <tr>
    <td><img src="img/banner_form.jpg" width="600" height="60"></td>
    </tr>
    <tr>
    <td>
    <table width="100%" border="0" cellspacing="1" cellpadding="1" class="bgwhite">
    <tr class="body">
    <td align="center" width="10%" nowrap class="sm_whitetxt"><a href="index.asp" class="sm_whitetxt">HOME</a></td>
    <td align="center" nowrap width="10%" class="sm_whitetxt"><a href="book.asp" class="sm_whitetxt">BOOK
    A TEST</a></td>
    <td width="10%" align="center" class="sm_whitetxt"><a href="links.asp" class="sm_whitetxt">LINKS</a></td>
    <td width="10%" align="center" class="sm_whitetxt"><a href="FAQS.asp" class="sm_whitetxt">FAQ'S</a></td>
    <td width="10%" align="center" class="sm_whitetxt"><a href="contact.asp" class="sm_whitetxt">CONTACTS</a></td>
    <td>&nbsp;</td>
    </tr>
    </table>
    </td>
    </tr>
    <tr>
    <td valign="top">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td width="100%" align="left" valign="top" class="bgwhite">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td class="sm_navytxt">&nbsp; </td>
    </tr>
    <tr>
    <td class="bg_purple" align="center"><img src="img/spacer.gif" width="1" height="1"></td>
    </tr>
    <tr>
    <td valign="top">
    <table width="100%" border="0" cellspacing="3" cellpadding="3">
    <tr>
    <td class="sm_navytxt"><img src="img/spacer.gif" width="8" height="8"><a href="index.asp" class="sm_navytxt">Home</a>
    &gt; Book a Test</td>
    </tr>
    <tr>
    <td class="navy_med_txt">
    <form name="input" method="get" action="<%=GetAction()%>">


    <table width="100%" border="0" cellspacing="2" cellpadding="2">
    <tr>
    <td align="center" height="20">&nbsp;</td>
    <td width="25%" height="20" class="navy_med_txt">&nbsp;</td>
    <td height="20" width="25%">&nbsp;</td>
    <td align="center" height="20" width="50%">&nbsp;</td>
    </tr>
    <tr>
    <td align="center" height="20"><img src="img/spacer.gif" width="1" height="1"></td>
    <td width="25%" height="20" class="titles_purple">Test
    to Be performed: </td>
    <td height="20" width="25%" class="navy_med_txt">
    <%response.write(request.querystring("test"))%>
    <input type="hidden" name="test" value="<% = response.write(request.querystring("test")) %> ">
    </td>
    <td align="center" height="20" width="50%"><img src="img/spacer.gif" width="1" height="1"></td>
    </tr>
    <tr>
    <td align="center" height="20">&nbsp;</td>
    <td width="25%" height="20" class="titles_purple">Insurance
    Company : </td>
    <td height="20" width="25%" class="navy_med_txt">
    <select size="1" name="primaryinsurance" id="primaryinsurance">
    <option value="#" selected>Select Insurance
    Company</option>
    <option value="bcbs">Blue Cross Blue Shield HMO</option>
    <option value="nobbs">Blue Cross Blue Shield HMO New England</option>
    <option value="nobbspos">Blue Cross Blue Shield POS</option>
    <option>Blue Cross Blue Shield POS New England</option>
    <option>Blue Cross Blue Shield PPO</option>
    <option>Blue Cross Blue
    Shield Direct Pay</option>
    <option>Blue Cross Blue Shield For Seniors</option>
    <option>Medicare</option>
    <option>Medicaid</option>
    <option>Tufts Health Plan</option>
    <option>Tufts HMO</option>
    <option>Tufts POS</option>
    <option>Tufts EPO</option>
    <option>Tufts PPO</option>
    <option>Tufts Navigator</option>
    <option>Tufts Liberty</option>
    <option>Tufts Carelink</option>
    <option>Tufts Medicare Complement (TMC)</option>
    <option>Tufts Medicare Complement Plan (MCP)</option>
    <option>Tufts Health Plan Medicare Preferred</option>
    <option>Tufts Uniformed Services Family Health
    Plan (USFHP)</option>
    <option>Havard Pligram Health Care HMO</option>
    <option>Havard Pligram Health Care POS</option>
    <option>Havard Pligram Health Care PPO</option>
    <option>Havard Pligram Health Care Best Buy
    POS &amp; PPO</option>
    <option>Havard Pligram Health Care Best Buy
    HSA (Health Saving Account)</option>
    <option>Havard Pligram Health Care First Seniority
    ( A Medicare Plan)</option>
    <option>Havard Pligram Health Care Nongroup</option>
    </select>
    </td>
    <td align="center" height="20" width="50%">&nbsp;</td>
    </tr>
    <tr>
    <td align="center" height="20">&nbsp;</td>
    <td width="25%" height="20" class="titles_purple">&nbsp;</td>
    <td height="20" width="25%">
    <input type="submit" name="Submit">


    </td>
    <td align="center" height="20" width="50%">&nbsp;</td>
    </tr>
    <tr>
    <td align="center" height="20">&nbsp;</td>
    <td width="25%" height="20" class="titles_purple">&nbsp;</td>
    <td height="20" width="25%" class="navy_med_txt"><a href="#" onClick="history.back()" class="navy_med_txt">&lt;
    Back</a> </td>
    <td align="center" height="20" width="50%">&nbsp;</td>
    </tr>
    </table> </form>
    <br>
    </td>
    </tr>
    </table>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    </td>
    </tr>
    </table>
    </td>
    </tr>
    <tr align="center">
    <td valign="top"><img src="img/spacer.gif" width="1" height="1"></td>
    </tr>
    </table>
    </td>
    </tr>
    </table>
    </body>
    </html>

  • #2
    Senior Coder
    Join Date
    Nov 2002
    Location
    North-East, UK
    Posts
    1,265
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Do you want to do this serverside or client side?

    To do it client side you need to use javascript.

    Code:
    <html>
    <head>
    <title> </title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <link rel="stylesheet" href="style.css" type="text/css">
    <script>
    function GetAction(){
    primaryinsurance = document.input.primaryinsurance.options[document.input.primaryinsurance.selectedIndex].value;
    	
    	if(primaryinsurance == "bcbs" || primaryinsurance == "nobbs" || primaryinsurance == "nobbspos"){
    		document.input.action = "presert.asp";
    		document.input.submit;
    	}
    	else{
    		document.input.action = "nopresert.asp";
    		document.input.submit;
    	}
    
    }
    </script>
    
    </head>
    
    <body bgcolor="#FFFFFF" text="#000000" topmargin="0" leftmargin="0">
     
    <form name="input" method="get" action="" onsubmit="GetAction()">
    
    <select size="1" name="primaryinsurance" id="primaryinsurance">
    <option value="#" selected>Select Insurance 
    Company</option>
    <option value="bcbs">Blue Cross Blue Shield HMO</option>
    <option value="nobbs">Blue Cross Blue Shield HMO New England</option>
    <option value="nobbspos">Blue Cross Blue Shield POS</option>
    <option>Blue Cross Blue Shield POS New England</option>
    <option>Blue Cross Blue Shield PPO</option>
    <option>Blue Cross Blue 
    Shield Direct Pay</option>
    <option>Blue Cross Blue Shield For Seniors</option>
    <option>Medicare</option>
    <option>Medicaid</option>
    <option>Tufts Health Plan</option>
    <option>Tufts HMO</option>
    <option>Tufts POS</option>
    <option>Tufts EPO</option>
    <option>Tufts PPO</option>
    <option>Tufts Navigator</option>
    <option>Tufts Liberty</option>
    <option>Tufts Carelink</option>
    <option>Tufts Medicare Complement (TMC)</option>
    <option>Tufts Medicare Complement Plan (MCP)</option>
    <option>Tufts Health Plan Medicare Preferred</option>
    <option>Tufts Uniformed Services Family Health 
    Plan (USFHP)</option>
    <option>Havard Pligram Health Care HMO</option>
    <option>Havard Pligram Health Care POS</option>
    <option>Havard Pligram Health Care PPO</option>
    <option>Havard Pligram Health Care Best Buy 
    POS &amp; PPO</option>
    <option>Havard Pligram Health Care Best Buy 
    HSA (Health Saving Account)</option>
    <option>Havard Pligram Health Care First Seniority 
    ( A Medicare Plan)</option>
    <option>Havard Pligram Health Care Nongroup</option>
    </select>
    
    <input type="submit" name="Submit">
     </form>
    
    </body>
    </html>

  • #3
    New to the CF scene
    Join Date
    Mar 2006
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    You rock

    Thank you very much. That was exactly what i needed!!!!!!!!


  •  

    Posting Permissions

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