Results 1 to 6 of 6

Thread: Process on current page then post hidden val to next page

  1. #1

    Thread Starter
    Fanatic Member aconybeare's Avatar
    Join Date
    Oct 2001
    Location
    UK
    Posts
    772

    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

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    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.

  3. #3

    Thread Starter
    Fanatic Member aconybeare's Avatar
    Join Date
    Oct 2001
    Location
    UK
    Posts
    772

    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?

  4. #4
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    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.

  5. #5

    Thread Starter
    Fanatic Member aconybeare's Avatar
    Join Date
    Oct 2001
    Location
    UK
    Posts
    772

    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:
    1. Private Sub cmdSubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSubmit.Click, cmdSubmit.Click
    2.   frmSubmit.Action = "nextpage.aspx"
    3.   frmSubmit.Submit()
    4. End Sub

  6. #6

    Thread Starter
    Fanatic Member aconybeare's Avatar
    Join Date
    Oct 2001
    Location
    UK
    Posts
    772

    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:
    1. Private Sub cmdSubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSubmit.Click, cmdSubmit.Click
    2. ' Do processing here then redirect including some hidden values
    3.   Response.Write("<form name=""hiddenvals"" action=""submission.aspx?page=1a"" method=""POST"" >")
    4.   Response.Write("<input type=""hidden"" name=""Var1"" value=""5"">")
    5.   Response.Write("<input type=""hidden"" name=""Var2"" value=""test"" >")
    6.   Response.Write("</form>")
    7.  
    8.   Response.Write("<script>")
    9.   Response.Write("document.forms[0].submit(); ")
    10.   Response.Write("</script>")
    11. 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
  •  



Click Here to Expand Forum to Full Width