You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by "Dan E." <ey...@db.erau.edu> on 2001/12/13 22:36:33 UTC

How to prevent form resubmit?

Hello:

I am trying to prevent a user from hitting the 'back' button on a browser
and resubmitting a form a second time. Does TDK2.1 have any facility to
prevent this? I am using straight HTML. I can't use any scripting of any
kind. Thanks.

Dan Eyassu


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: How to prevent form resubmit?

Posted by "Dan E." <ey...@db.erau.edu>.
Thanks.

Dan Eyassu

On Mon, 17 Dec 2001, Andrea Papotti wrote:

> > I am trying to prevent a user from hitting the 'back' button on a browser
> > and resubmitting a form a second time. [...] I can't use any scripting of
> any
> > kind
> 
> IMHO there is no way to avoid the back button (or the backspace key)
> whithout scripts...
> 
> ...but you can put an hidden value and check the value for previous submit.
> 
> ...you can also put these three lines in your 'default.vm' layout to prevent
> caching (so the browser tells the user that he/she it's going to resubmit
> the form)
> 
> $data.getResponse().setHeader("Pragma", "no-cache")        ## HTTP 1.0
> 
> $data.getResponse().setHeader("Cache-Control", "no-cache") ## HTTP 1.1
> 
> $data.getResponse().setHeader("Expires", "0")              ## prevents
> caching at the proxy server, should be setDateHeader("Expires", 0)
> 
> 
> hope it's usefull for you
> 
> Andrea
> ---- --- -- - - -- --- ----
> 
> 'The Computer made me do it.'
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 
> 


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: How to prevent form resubmit?

Posted by Andrea Papotti <bi...@ettelematica.it>.
> I am trying to prevent a user from hitting the 'back' button on a browser
> and resubmitting a form a second time. [...] I can't use any scripting of
any
> kind

IMHO there is no way to avoid the back button (or the backspace key)
whithout scripts...

...but you can put an hidden value and check the value for previous submit.

...you can also put these three lines in your 'default.vm' layout to prevent
caching (so the browser tells the user that he/she it's going to resubmit
the form)

$data.getResponse().setHeader("Pragma", "no-cache")        ## HTTP 1.0

$data.getResponse().setHeader("Cache-Control", "no-cache") ## HTTP 1.1

$data.getResponse().setHeader("Expires", "0")              ## prevents
caching at the proxy server, should be setDateHeader("Expires", 0)


hope it's usefull for you

Andrea
---- --- -- - - -- --- ----

'The Computer made me do it.'


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: How to prevent form resubmit?

Posted by "Dan E." <ey...@db.erau.edu>.
Thanks, that did the trick.

Dan Eyassu

On Fri, 14 Dec 2001, John McNally wrote:

> "Dan E." wrote:
> > 
> > Hello:
> > 
> > I am trying to prevent a user from hitting the 'back' button on a browser
> > and resubmitting a form a second time. Does TDK2.1 have any facility to
> > prevent this? I am using straight HTML. I can't use any scripting of any
> > kind. Thanks.
> > 
> > Dan Eyassu
> > 
> > --
> > To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> > For additional commands, e-mail: <ma...@jakarta.apache.org>
> 
> 
> add the following to the form:  (you may need to fix this up, I did not
> grab it from a working example)
> 
> <input type="hidden" name="_session_access_counter"
> value="$data.User.AccessCounterForSession" />
> 
> you should then in TR.props specify a template (that lives under your
> screens directory) that tells the user to quit hitting reload when
> submitting forms.
> 
> template.invalidstate=InvalidState.vm
> 
> Can someone find a good place to put this in the docs, so it does not
> get asked over and over?
> 
> john mcnally
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 
> 


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: How to prevent form resubmit?

Posted by John McNally <jm...@collab.net>.
"Dan E." wrote:
> 
> Hello:
> 
> I am trying to prevent a user from hitting the 'back' button on a browser
> and resubmitting a form a second time. Does TDK2.1 have any facility to
> prevent this? I am using straight HTML. I can't use any scripting of any
> kind. Thanks.
> 
> Dan Eyassu
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>


add the following to the form:  (you may need to fix this up, I did not
grab it from a working example)

<input type="hidden" name="_session_access_counter"
value="$data.User.AccessCounterForSession" />

you should then in TR.props specify a template (that lives under your
screens directory) that tells the user to quit hitting reload when
submitting forms.

template.invalidstate=InvalidState.vm

Can someone find a good place to put this in the docs, so it does not
get asked over and over?

john mcnally

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>