Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ASP Form POST to itself w/o new pg in browser?

1 view
Skip to first unread message

Tim Walsh

unread,
Apr 14, 2003, 4:32:28 PM4/14/03
to
Here's what I need to do:

Form needs to collect info from user, when submitted, it needs to do some
validations, then stick the data in a db and give user confirmation that it
worked. Currently, this is done using the approach of inputform.asp ->
process.asp -> confirm.asp. If there are errors caught in process.asp,
they're listed and user is told to "click here" to go back and fix the
offending data. Boss now wants the whole thing done as a single page, and
if there are errors, they're flagged right next to the offending field in
red. This is easy enough, and the form shows up with the errors highlighted
and a suitable warning to the user to fix things. However, every time you
submit the form, it creates a new page in the browser instead of replacing
the existing one. So, if you try to submit it 3x without going back to the
"previous" one, you now have to wade back through as many failed attempts.
How do you get posting to *NOT* create a new page reference in the browser
(history) and reuse the one it came from? This is driving me nuts!

BTW, this is ASP 5.whatever on Windows 2000 SP3.

Thanks...


Curt_C [MVP]

unread,
Apr 14, 2003, 4:42:49 PM4/14/03
to
Show your FORM tag

--
----------------------------------------------------------
Curt Christianson (Software_AT_Darkfalz.Com)
Owner/Lead Designer, DF-Software
http://www.Darkfalz.com
---------------------------------------------------------
..Offering free scripts & code snippets for everyone...
---------------------------------------------------------
"Tim Walsh" <no.e...@dev.nul> wrote in message
news:eLXCdUsA...@TK2MSFTNGP12.phx.gbl...

Tim Walsh

unread,
Apr 14, 2003, 5:09:17 PM4/14/03
to
Do you mean as in:
<form method="POST" action="contact_gen.asp">

I have also tried it as action=<%= Request.ServerVariables("SCRIPT_NAME") %>

"Curt_C [MVP]" <Software_AT_Darkfalz.com> wrote in message
news:#EWcjXsA...@TK2MSFTNGP12.phx.gbl...

Don Grover

unread,
Apr 14, 2003, 5:30:54 PM4/14/03
to
Try <form method="POST" action="contact_gen.asp" target="_self">
Notice the target="_self" this will post back without new window

Regards
Don

"Tim Walsh" <no.e...@dev.nul> wrote in message

news:#F6VBpsA...@TK2MSFTNGP10.phx.gbl...

Tim Walsh

unread,
Apr 14, 2003, 5:47:17 PM4/14/03
to
I've toyed with _top and _self, but the problem isn't about a new *window*
opening, it's a new *page* being created in the browser window.

For example, you have the form page, make errors on it, hit submit, you get
another page containing the form, the data entered, and the errors
highlighted. If you hit the [back] button, you are returned to the previous
incarnation of the form (or look in the history dropdown and you'll see
however many incarnations you've gone through there).

The idea is if you input with no mistakes, you get a confirmation saying it
went in and the form is no longer there. If there were mistakes, you want
only the form as it currently is, not however many attempts were made to get
it right. Surely, this can be done, because I've seen it on a number
banking sites and many of them are using ASP.

"Don Grover" <dgr...@assoft.com.au> wrote in message
news:OoxCj0sA...@TK2MSFTNGP10.phx.gbl...

Phillip Windell

unread,
Apr 15, 2003, 11:10:50 AM4/15/03
to
Don't let the form page "cache" then it won't be in the History.

Response.Expires = 0
Response.Expiresabsolute = Now() - 1
Response.AddHeader "pragma","no-cache"
Response.AddHeader "cache-control","private"
Response.CacheControl = "no-cache"

The script that you submit to should be able to send *either* a new form
already populated with the previously posted data *or* redirect to the
success page depending on the if the data was valid or not.


--

Phillip Windell
pwin...@wandtv.com
WAND-TV (ABC Affiliate)
www.wandtv.com

"Tim Walsh" <no.e...@dev.nul> wrote in message

news:u7c3Q#sADHA...@TK2MSFTNGP10.phx.gbl...

Tim Walsh

unread,
Apr 15, 2003, 11:52:05 AM4/15/03
to
Thanks for the suggestion, Phillip. I just tried it, but it's doing the
same thing. Clicking submit with errors on the form creates a new page in
the browser, with the previous one still there before it. Can you think of
anything else to try?

This is maddening! I'm beginning to think I'm going to be stuck using an
<IFRAME> approach with that damn secondary processing page in the mix.

Surely someone else out there has done this, or maybe something more
primitive like a login dialog...surely you don't want scores of failed login
attempts piling up?

"Phillip Windell" <pwin...@wandtv.com> wrote in message
news:es1f7D2A...@TK2MSFTNGP12.phx.gbl...

Phillip Windell

unread,
Apr 15, 2003, 1:02:26 PM4/15/03
to
"Tim Walsh" <no.e...@dev.nul> wrote in message
news:ee3qdc2A...@TK2MSFTNGP11.phx.gbl...

> This is maddening! I'm beginning to think I'm going to be stuck using an
> <IFRAME> approach with that damn secondary processing page in the mix.

Do that only if you want even more trouble than you already have.

I don't know what else to tell you. The code snip I gave you is right off a
page that does exactly what I want it to do.

litningmatt

unread,
Apr 17, 2003, 6:03:39 PM4/17/03
to
"Phillip Windell" <pwin...@wandtv.com> wrote in message news:<#yY2SC3A...@TK2MSFTNGP12.phx.gbl>...

> "Tim Walsh" <no.e...@dev.nul> wrote in message
> news:ee3qdc2A...@TK2MSFTNGP11.phx.gbl...
> > This is maddening! I'm beginning to think I'm going to be stuck using an
> > <IFRAME> approach with that damn secondary processing page in the mix.
>
> Do that only if you want even more trouble than you already have.
>
> I don't know what else to tell you. The code snip I gave you is right off a
> page that does exactly what I want it to do.

I think what's happening is that it's clearing the text boxes if an
error is found. What you need is to store the contents of those boxes
in some variables, and then do something like:

<input type="text" name="txtPublisher" size="28"
value="<%=strPublisher%>">

where the value is whatever is contained in that particular variable.

Matt

0 new messages