Navigate
Home
ArticleWiki
Forum
Journal
Search
Newsletter
Links
Tech News
expertsrt.com
Welcome Guest.
Username:

Password:

Remember me

post form to itself
Welcome, Guest. Please login or register.
December 02, 2008, 08:26:28 AM
11304 Posts in 1248 Topics by 498 Members
Latest Member: katCheeme
Experts Round Table Network  |  Serverside Technology  |  ASP  |  post form to itself « previous next »
Pages: [1]
Author Topic: post form to itself  (Read 523 times)
Johnny26652

Offline Offline

Posts: 61


« on: July 18, 2007, 04:33:54 PM »

i am having trouble posting the form to itself. Any one has suggestions doing it the best way..when user is refreshing the page the form is posting again(the second time). how can i avoid it? thanks.

the asp form results are not in a database


John
« Last Edit: July 18, 2007, 04:40:14 PM by Johnny26652 » Logged

Johnny
rdivilbiss
Moderator
*
Offline Offline

Posts: 414



WWW
« Reply #1 on: July 18, 2007, 04:52:42 PM »

http://www.rodsdot.com/ee/progess_bar_form_handler.asp is a possibility, but I have an article more specific to this I am looking for.
« Last Edit: July 18, 2007, 04:54:34 PM by rdivilbiss » Logged

Rod
rdivilbiss
Moderator
*
Offline Offline

Posts: 414



WWW
« Reply #2 on: July 18, 2007, 05:20:05 PM »

I must have had a brain fart....this is easy.

if request.servervariables("HTTP_METHOD")="POST" then
    ' process the form post
else
    ' the first time on the form, or a page refresh, fall through to the form.
end if

If you want to validate the form, before processing it, and may have to redisplay the form with the values submitted, you add....

if request.servervariables("HTTP_METHOD")="POST" then
    ' process the form post
    ' retrieve and filter all the input
   ' verify the data is correct for submission - e.g. to a db or to an email
   if (valid_data) then
       ' do the db insert, update or e-mail, whatever
      response.redirect('success.asp')
   else
      ' fall through to the form
       message = "Please fix the errors"
   end if
else
    ' the first time on the form, or a page refresh, fall through to the form.
end if

Then in the HTML

<form>
<%
if message <> "" then
    response.write "<p>"&message&"</p>"
%>
<input name="field1" value="<%=filtered_and_safe_posted_field1%>

etc.

Which, by the way, is how I decide whether or not to show the progress bar in the link above...which you should only need for a really slow processing page.
Logged

Rod
Johnny26652

Offline Offline

Posts: 61


« Reply #3 on: July 18, 2007, 05:45:51 PM »

i have a poll form/poll results in the same form. when a user submits his choice the poll results will be updated.
is it possible to have both form and results shown in the same page and prevent  submit if the user refreshes the form..

Rod,
How are able to disable the back button?

thanks
« Last Edit: July 18, 2007, 06:03:09 PM by Johnny26652 » Logged

Johnny
rdivilbiss
Moderator
*
Offline Offline

Posts: 414



WWW
« Reply #4 on: July 18, 2007, 06:37:39 PM »

You can't truly disable the back button, and I'm writing your poll-vote script as I post.

Logged

Rod
Pages: [1]
« previous next »
    Jump to: