Process on current page then post hidden val to next page
Hi,
I'm wanting to process a form on the current page then send some hidden values to the next page i.e user Id, current journal name, manuscript number etc.
At the moment I'm using response.redirect and putting them in the queryString but I don't want to expose the user id in the querystring, I also want to avoid using cookies and session variables to hold this data.
Does anyone know if this is possible? Is there a way to use response.redirect and post?
Cheers Al
Re: Process on current page then post hidden val to next page
How about submitting the form? document.forms[0].submit(); and make sure that the method of the form is post.
Re: Process on current page then post hidden val to next page
Mendhak,
Thanks for your reply, where would I put the -
Quote:
document.forms[0].submit();
In my codebehind page after saveData returns ok?
And how do I tell it where to submit to?
Re: Process on current page then post hidden val to next page
Instead of Response.Redirect, use Page.RegisterStartupScript to run that code when the page loads.
Re: Process on current page then post hidden val to next page
mendhak,
I'm sorry, but I'm having real trouble getting my head round this
Is it possible to change a forms action on the fly then resubmit it.
eg -
html
Code:
<form id="frmSubmit" method="post" runat="server">
<asp:textbox id=myName text=allan runat=server/><br>
<asp:button id=cmdSubmit text=Submit runat=server/>
</form>
codebehind
VB Code:
Private Sub cmdSubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSubmit.Click, cmdSubmit.Click
frmSubmit.Action = "nextpage.aspx"
frmSubmit.Submit()
End Sub
Re: Process on current page then post hidden val to next page
Right,
I think I'm getting there now but it's not ideal as I have 40+ controls to write out
It would be better if I could just redirect the original form
VB Code:
Private Sub cmdSubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSubmit.Click, cmdSubmit.Click
' Do processing here then redirect including some hidden values
Response.Write("<form name=""hiddenvals"" action=""submission.aspx?page=1a"" method=""POST"" >")
Response.Write("<input type=""hidden"" name=""Var1"" value=""5"">")
Response.Write("<input type=""hidden"" name=""Var2"" value=""test"" >")
Response.Write("</form>")
Response.Write("<script>")
Response.Write("document.forms[0].submit(); ")
Response.Write("</script>")
End Sub