Post to another url

  • Thread starter Thread starter Matt
  • Start date Start date
M

Matt

Hi all,

Not very sure about this. I have one button (not a submit button) will
"post" partial page(form) info to another url(the user will also redirect to
this url :-). I dont' want to change the webpage interface, so how can I
POST partial form info? by using a tmp url???


TIA


-matt
 
Here's some ideas for you.
1) Output an old fashioned non-server form to the client (without the runat=
'server' attribute) Set the action attribute like you would have in
ASP.OLD, and use javascript to submit the form.
2) use client side script to change your ASP.NET form action attribute
3) use this webform control: http://www.wilsondotnet.com/Controls/
 
2) use client side script to change your ASP.NET form action attribute
Can I have more insight on this or 1)
 
It likes that I have two buttons, one for submitting whole form to one url
and another submiting partial form info to another url via "post". So
problem are these:
1) can I have two "submit" buttons in one form?
2) if no, can I simulate "submit"? If I can simulate, how about NN?
 
You can have as many submit buttons as you want, but no matter which of them
is clicked, it will do the same as the others (submit the data according to
the ACTION of the form tag).

You can submit via JavaScript (form.submit()).
 
On page1 I have a button which will redirect the user to page2.aspx when
"onclick". here is page2.aspx, doesn't work

<%@ Page language="c#" Trace="false" TraceMode="SortByCategory" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<html><head>
<%
Response.Write("<script for=window event=onload language='JavaScript'>");
Response.Write("form.submit();");
Response.Write("</script>");
%>
</head><body><form action=url method="post"><input type="hidden" name="cmd"
value="_xclick">
<input type="image" src=source border="0"
name="submit"></form></body></html>
 
What are you trying to do on this page? Where does the form's "url" get a
value? You need to give your form a name so that the script can call it,
rather than just generically "form". You should also put the script below
the form in the code. You also don't need the for=window event=onload if
you are not going to place the script in a function.
 
I don't want to disable all other attributes rather than the info need to be
POSTed on same page(page1), so I redirect it (when button1 clicking) to
another page with a simplified form and automaticlly submit the form when
the window is loading. I'm suspecting this is not the best way though.

The button1 is actually a PayPal buynow button which just asks some
particular info it needs, a subset of my form's attrs(the page is a signup
page). I'm still looking a more elegant way :-).

Thanks for all tips. It works now.
 
Back
Top