dohdohdoh
asked on
easy way to do If value = x, then form action is "...", else form action is "..."
I need to change my form action based on the country value collected previously, but the way I have it doesn't work. I've also tried
if x then <form name=...action=...method=p ost> else <form name...
...whole lot of asp form actions....
but that didn't work either, both give expected statement error.
can anyone help me rewrite it so it doesn't complain?
if x then <form name=...action=...method=p
...whole lot of asp form actions....
but that didn't work either, both give expected statement error.
can anyone help me rewrite it so it doesn't complain?
<form name="checkout_PP_LI_Hid" action= <%if (NOT Request.Form("shipping_country")="AU") then "checkout_success.asp" else "https://www.PayPal.com/cgi-bin/webscr" end if %> method="post">
Hi there
do you want to do this before the form has been posted? If so, it need to be done using javascript. Check the following code. It changes the action value of the form depending on what you select in the dropdown.
If you want to do it depending on the value of a previously posted form, the reply of om_prakash_p should cover you.
do you want to do this before the form has been posted? If so, it need to be done using javascript. Check the following code. It changes the action value of the form depending on what you select in the dropdown.
If you want to do it depending on the value of a previously posted form, the reply of om_prakash_p should cover you.
<html>
<head>
<title>EE Test file - Question: 25491504 </title>
<script type="text/javascript">
function updFormPost(cnt)
{
if (cnt=="AU")
{ document.getElementById("chkForm").action="https://www.PayPal.com/cgi-bin/webscr"; }
else
{ document.getElementById("chkForm").action="checkout_success.asp"; }
}
</script>
</head>
<body>
<form id="chkForm" name="checkout_PP_LI_Hid" action="checkout_success.asp" method="post">
<select size="1" name="country" onchange="updFormPost(options[selectedIndex].value)">
<option value=""></option>
<option value="AU">Australia</option>
<option value="US">USA</option>
<option value="UK">United Kingdom</option>
</select>
<input type="submit" />
</body>
</html>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window