call post w/ classic asp
am 19.09.2007 14:53:35 von jp2code
I've got a form that posts to itself when submitted.
Right now, after the form is submitted, the code checks that all of its
fields are valid, then processes the information. If all goes well, visitors
are then redirected using Response.Redirect("thanks.asp").
What I'd like to do is replace Response.Redirect("thanks.asp") with
something more like the post that happens on the form so that "thanks.asp"
can display a summary of what was submitted.
Is there a way to do this? Can you call a "post" somehow from Classic ASP?
I have not spent a lot of time with ASP, so it could be something simple!
Re: call post w/ classic asp
am 19.09.2007 14:59:07 von Tim Slattery
"jp2code" wrote:
>I've got a form that posts to itself when submitted.
>
>Right now, after the form is submitted, the code checks that all of its
>fields are valid, then processes the information. If all goes well, visitors
>are then redirected using Response.Redirect("thanks.asp").
>
>What I'd like to do is replace Response.Redirect("thanks.asp") with
>something more like the post that happens on the form so that "thanks.asp"
>can display a summary of what was submitted.
>
>Is there a way to do this? Can you call a "post" somehow from Classic ASP?
No. IMHO the best way to handle this is to store the data from the
form into the session object (Session("myvar")=whatever). Then the
page you forward to can retrieve the data from there and do whatever
it wants with it.
--
Tim Slattery
MS MVP(DTS)
Slattery_T@bls.gov
http://members.cox.net/slatteryt
Re: call post w/ classic asp
am 19.09.2007 15:18:45 von Mike Brind
"jp2code" wrote in message
news:%23eVvUwr%23HHA.748@TK2MSFTNGP04.phx.gbl...
> I've got a form that posts to itself when submitted.
>
> Right now, after the form is submitted, the code checks that all of its
> fields are valid, then processes the information. If all goes well,
> visitors are then redirected using Response.Redirect("thanks.asp").
>
> What I'd like to do is replace Response.Redirect("thanks.asp") with
> something more like the post that happens on the form so that "thanks.asp"
> can display a summary of what was submitted.
>
> Is there a way to do this? Can you call a "post" somehow from Classic ASP?
>
Instead of Response.Redirect, use Response.Write to summarise what was
submitted. Yes, it really is that simple.
<%
Sub showform
%>
<%
End Sub
If Request.Form("Submit") = "" Then
call showform()
Else
If Len(Trim(Request.Form("FirstName")))>0 Then
Response.Write "Your name is " & Trim(Request.Form("FirstName"))
Response.Write "
Thanks!!"
Else
Response.Write "You forgot to enter your name"
call showform()
End If
End If
%>
--
Mike Brind
Re: call post w/ classic asp
am 19.09.2007 15:33:58 von Mike Brind
"Mike Brind" wrote in message
news:u7Iqg%23r%23HHA.5164@TK2MSFTNGP05.phx.gbl...
>
> "jp2code" wrote in message
> news:%23eVvUwr%23HHA.748@TK2MSFTNGP04.phx.gbl...
>> I've got a form that posts to itself when submitted.
>>
>> Right now, after the form is submitted, the code checks that all of its
>> fields are valid, then processes the information. If all goes well,
>> visitors are then redirected using Response.Redirect("thanks.asp").
>>
>> What I'd like to do is replace Response.Redirect("thanks.asp") with
>> something more like the post that happens on the form so that
>> "thanks.asp" can display a summary of what was submitted.
>>
>> Is there a way to do this? Can you call a "post" somehow from Classic
>> ASP?
>>
>
> Instead of Response.Redirect, use Response.Write to summarise what was
> submitted. Yes, it really is that simple.
>
> <%
> Sub showform
> %>
>
> <%
> End Sub
>
> If Request.Form("Submit") = "" Then
> call showform()
> Else
> If Len(Trim(Request.Form("FirstName")))>0 Then
> Response.Write "Your name is " & Trim(Request.Form("FirstName"))
> Response.Write "
Thanks!!"
> Else
> Response.Write "You forgot to enter your name"
> call showform()
> End If
> End If
> %>
>
By the way, if you really do want to bounce visitors from one page to the
next, a simple way to expidite Tim's suggestions is as follows:
For Each x in Request.Form
If x <> "Submit" then Session(x) = Request.Form(x)
Next
Response.Redirect "thanks.asp"
You should also be aware that there is no way to guarantee the order in
which the Request.Form collection contents are passed.
--
Mike Brind
Re: call post w/ classic asp
am 19.09.2007 15:49:49 von jp2code
Wow! That's something slick I probably would not have thought of!
Thanks Mr. Brind!
"Mike Brind" suggests:
>
> By the way, if you really do want to bounce visitors from one page to the
> next, a simple way to expidite Tim's suggestions is as follows:
>
> For Each x in Request.Form
> If x <> "Submit" then Session(x) = Request.Form(x)
> Next
> Response.Redirect "thanks.asp"
>
> You should also be aware that there is no way to guarantee the order in
> which the Request.Form collection contents are passed.
>
> --
> Mike Brind
>
Re: call post w/ classic asp
am 19.09.2007 15:50:38 von jp2code
Mr. Slattery:
Thanks! That was even easy to implement! I've already got it working.
A+
"Tim Slattery" wrote:
>
> No. IMHO the best way to handle this is to store the data from the
> form into the session object (Session("myvar")=whatever). Then the
> page you forward to can retrieve the data from there and do whatever
> it wants with it.
>
> --
> Tim Slattery
> MS MVP(DTS)
> Slattery_T@bls.gov
> http://members.cox.net/slatteryt
Re: call post w/ classic asp
am 19.09.2007 17:59:06 von Jon Paal
instead of redirecting, you can use "server.execute". When you need to process that code, use :
server.execute("thanks.asp")
the "thanks.asp" file will have use of all information in the request object.
"jp2code" wrote in message news:%23eVvUwr%23HHA.748@TK2MSFTNGP04.phx.gbl...
> I've got a form that posts to itself when submitted.
>
> Right now, after the form is submitted, the code checks that all of its fields are valid, then processes the information. If all
> goes well, visitors are then redirected using Response.Redirect("thanks.asp").
>
> What I'd like to do is replace Response.Redirect("thanks.asp") with something more like the post that happens on the form so that
> "thanks.asp" can display a summary of what was submitted.
>
> Is there a way to do this? Can you call a "post" somehow from Classic ASP?
>
> I have not spent a lot of time with ASP, so it could be something simple!
>
Re: call post w/ classic asp
am 19.09.2007 18:12:45 von jp2code
So, lots of different tricks for doing the same thing! I like it!
"Jon Paal [MSMD]" pointed out:
> instead of redirecting, you can use "server.execute". When you need to
> process that code, use :
>
> server.execute("thanks.asp")
>
> the "thanks.asp" file will have use of all information in the request
> object.
>
Re: call post w/ classic asp
am 19.09.2007 18:22:41 von Dave Anderson
"jp2code" wrote:
> So, lots of different tricks for doing the same thing! I like it!
Can you stand another? There is also Server.Transfer:
http://msdn2.microsoft.com/en-us/library/ms525800.aspx
--
Dave Anderson
Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms.
Re: call post w/ classic asp
am 20.09.2007 09:31:41 von Anthony Jones
"jp2code" wrote in message
news:ex9IwPs%23HHA.3548@TK2MSFTNGP06.phx.gbl...
> "Mike Brind" suggests:
> >
> > By the way, if you really do want to bounce visitors from one page to
the
> > next, a simple way to expidite Tim's suggestions is as follows:
> >
> > For Each x in Request.Form
> > If x <> "Submit" then Session(x) = Request.Form(x)
> > Next
> > Response.Redirect "thanks.asp"
> >
> > You should also be aware that there is no way to guarantee the order in
> > which the Request.Form collection contents are passed.
> >
> > --
> > Mike Brind
> >
>
> Wow! That's something slick I probably would not have thought of!
>
> Thanks Mr. Brind!
>
The problem with this approach is you pollute the Session object, which is
common to all pages for that session, with internal details regarding a
specific page. This is not a good thing. Consider what would happen if
such a form happened use a field name that matches an existing session
variable being used for a complete different purpose.
Use Server.Execute as suggested by Jon Paal, whist there are many solutions
to your requirement Server.Execute is the most appropriate.
--
Anthony Jones - MVP ASP/ASP.NET
Re: call post w/ classic asp
am 21.09.2007 05:31:28 von Adrienne Boswell
Gazing into my crystal ball I observed "jp2code"
writing in news:#eVvUwr#HHA.748@TK2MSFTNGP04.phx.gbl:
> I've got a form that posts to itself when submitted.
>
> Right now, after the form is submitted, the code checks that all of
> its fields are valid, then processes the information. If all goes
> well, visitors are then redirected using
> Response.Redirect("thanks.asp").
>
> What I'd like to do is replace Response.Redirect("thanks.asp") with
> something more like the post that happens on the form so that
> "thanks.asp" can display a summary of what was submitted.
>
> Is there a way to do this? Can you call a "post" somehow from Classic
> ASP?
>
> I have not spent a lot of time with ASP, so it could be something
> simple!
>
>
The way I deal with this is this:
1. Start the page off with issubmitted = false
2. Validate and do whatever posting to db I need to do.
3. Change issubmitted to true
HTML is something like:
<% if not issubmitted then%>