473,236 Members | 1,784 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,236 software developers and data experts.

POST url based upon item selected in dropdown list (sounds Simple)

Is this possible? I have three items in drop down "Select Payment
Type", "Credit Card" and "Check". if user select Credit card then i
need to post the form variables to different URL than check selecting.

Thanks for your help in advance.

suresh
....... Method="POST", Action= & url ........

IF (dropdown.index =1)
{
url = "http://somebank.com/1/post.asp"
}

IF (dropdown.index =2)
{
url = "http://somebank.com/2/post.asp"

}

Oct 18 '06 #1
5 3125
Using client-side script, you can accomplish this, but be very, very certain
that you want to rely on this instead of creating a server-side solution...
<html>
<body>
<form id="x" method="post" action="default.asp">
<select name="s"
onchange="document.getElementById('x').action=this .value;">
<option value="default.asp">Select Payment Type</option>
<option value="cc.asp">Credit Card</option>
<option value="check.asp">Check</option>
</select>
</form>
Test it:
<input type="button" onclick="alert(document.getElementById('x').action );"
value="Show Form Action" />
</body>

Ray at work

"SA SA" <su*******@gmail.comwrote in message
news:11**********************@e3g2000cwe.googlegro ups.com...
Is this possible? I have three items in drop down "Select Payment
Type", "Credit Card" and "Check". if user select Credit card then i
need to post the form variables to different URL than check selecting.

Thanks for your help in advance.

suresh
...... Method="POST", Action= & url ........

IF (dropdown.index =1)
{
url = "http://somebank.com/1/post.asp"
}

IF (dropdown.index =2)
{
url = "http://somebank.com/2/post.asp"

}

Oct 19 '06 #2
Ray,
thanks for your tip however you planted doubt on my mind about relaying
on client side script. This is what i have so far works well except
when user presses back botton everything out of wack. Is there way to
do this on server side?

thanks
sa
<html>

<form name="t1" id="x" method="post" action="refresh" onsubmit=" return
confirm1_dropdown()">

<select name="s"
onchange="document.getElementById('x').action=this .value;">
<option value="default.asp">Select Payment Type</option>
<option value="https://somebank.com/Pay/1/Gateway.aspx">Credit
Card</option>
<option value="https://somebank.com/Pay/2/Gateway.aspx">Check
Payment</option>
</select>

<input type="hidden" Value ="Account Balance"
name="PMT_TYPE_DESC" >
<input type="hidden" Value ="701" name="PMT_TYPE" >
<input type="hidden" Value ="701" name="AMOUNT_PAID" >
<input type="hidden" Value ="2718" name="ACCOUNT" >
<input type="hidden" Value ="ABC" name="STUDENT_LASTNAME" >
<p>&nbsp;
<input type="submit" value="Pay Now" ID ="x" ></p>
</form>
<script Language="JavaScript">
<!--
function confirm1_dropdown()
{
if (t1.s.selectedIndex == 0)
{
alert("Please select a payment type.");
t1.s.focus();
return (false);
}
return (true);
}

//--></script>

</html>

Oct 19 '06 #3
Are you posting the form data to a third party site, meaning you don't have
control over the server that needs to receive the post data?

Ray at work
"SA SA" <su*******@gmail.comwrote in message
news:11*********************@e3g2000cwe.googlegrou ps.com...
Ray,
thanks for your tip however you planted doubt on my mind about relaying
on client side script. This is what i have so far works well except
when user presses back botton everything out of wack. Is there way to
do this on server side?

thanks
sa
<html>

<form name="t1" id="x" method="post" action="refresh" onsubmit=" return
confirm1_dropdown()">

<select name="s"
onchange="document.getElementById('x').action=this .value;">
<option value="default.asp">Select Payment Type</option>
<option value="https://somebank.com/Pay/1/Gateway.aspx">Credit
Card</option>
<option value="https://somebank.com/Pay/2/Gateway.aspx">Check
Payment</option>

Oct 19 '06 #4
That's true

Ray Costanzo [MVP] wrote:
Are you posting the form data to a third party site, meaning you don't have
control over the server that needs to receive the post data?

Ray at work
"SA SA" <su*******@gmail.comwrote in message
news:11*********************@e3g2000cwe.googlegrou ps.com...
Ray,
thanks for your tip however you planted doubt on my mind about relaying
on client side script. This is what i have so far works well except
when user presses back botton everything out of wack. Is there way to
do this on server side?

thanks
sa
<html>

<form name="t1" id="x" method="post" action="refresh" onsubmit=" return
confirm1_dropdown()">

<select name="s"
onchange="document.getElementById('x').action=this .value;">
<option value="default.asp">Select Payment Type</option>
<option value="https://somebank.com/Pay/1/Gateway.aspx">Credit
Card</option>
<option value="https://somebank.com/Pay/2/Gateway.aspx">Check
Payment</option>
Oct 19 '06 #5
In that case, I swing back to the other side and suggest that you DO rely on
client-side script. Either that, or have the user select his payment type
on one page, post that data back to YOUR server, and then present him with a
form with the appropriate action value already set based on server-side
logic.

Ray at work

"SA SA" <su*******@gmail.comwrote in message
news:11**********************@e3g2000cwe.googlegro ups.com...
That's true

Ray Costanzo [MVP] wrote:
>Are you posting the form data to a third party site, meaning you don't
have
control over the server that needs to receive the post data?

Ray at work
"SA SA" <su*******@gmail.comwrote in message
news:11*********************@e3g2000cwe.googlegro ups.com...
Ray,
thanks for your tip however you planted doubt on my mind about relaying
on client side script. This is what i have so far works well except
when user presses back botton everything out of wack. Is there way to
do this on server side?

thanks
sa
<html>

<form name="t1" id="x" method="post" action="refresh" onsubmit=" return
confirm1_dropdown()">

<select name="s"
onchange="document.getElementById('x').action=this .value;">
<option value="default.asp">Select Payment Type</option>
<option value="https://somebank.com/Pay/1/Gateway.aspx">Credit
Card</option>
<option value="https://somebank.com/Pay/2/Gateway.aspx">Check
Payment</option>

Oct 19 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Kris Rockwell | last post by:
Hello (again), I have gotten the dropdown list functionality to work through a few tricks (probably not the most efficient, but it works) but I am not sure how to set the default selected value....
5
by: Kris Rockwell | last post by:
Hello (again), I have gotten the dropdown list functionality to work through a few tricks (probably not the most efficient, but it works) but I am not sure how to set the default selected value....
7
by: dickson.matt | last post by:
Ok simple question (that I feel dumb for asking).... I have created a user control (ascx page) that contains a dropdown list. The problem I am having is that when the postback occurs I can...
6
by: yasodhai | last post by:
Hi, I used a dropdown control which is binded to a datagrid control. I passed the values to the dropdownlist from the database using a function as follows in the aspx itself. <asp:DropDownList...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.