|
-
Sep 28th, 2005, 04:31 AM
#1
Thread Starter
Fanatic Member
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
-
Sep 28th, 2005, 08:23 AM
#2
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.
-
Sep 28th, 2005, 08:27 AM
#3
Thread Starter
Fanatic Member
Re: Process on current page then post hidden val to next page
Mendhak,
Thanks for your reply, where would I put the -
document.forms[0].submit();
In my codebehind page after saveData returns ok?
And how do I tell it where to submit to?
-
Sep 28th, 2005, 09:25 AM
#4
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.
-
Sep 29th, 2005, 11:02 AM
#5
Thread Starter
Fanatic Member
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
-
Sep 29th, 2005, 11:21 AM
#6
Thread Starter
Fanatic Member
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|