Grails JIRA

  • Log In Access more options
    • Online Help
    • GreenHopper Help
    • Agile Answers
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What’s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • Agile
Grails
  • Grails
  • GRAILS-3406 Top level task: Controller Improvements
  • GRAILS-208

Add support for preventing double-post problem

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Sub-task Sub-task
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 0.3, 0.4
  • Fix Version/s: 1.1-beta3
  • Component/s: Controllers
  • Labels:
    None

Description

Implement auto ticketing using g:form tag - via an implicit model var preferably so non-GSP views could use the same ticketing logic and caching. Controllers would then dedupe tickets before calling actions, and we could have something like this for action declarations:

def save = {
// perform saving
}
def saveInvalid = {
// handle invalid submission
}

Issue Links

is duplicated by

Sub-task - The sub-task of the issue GRAILS-3653 Prevent Double Submits

  • Major - Major loss of function.
  • Closed - The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
  • Git Commits
Hide
Permalink
Sven Haiges added a comment - 24/Aug/06 4:18 AM

Love it. Double form submission is a big pain and having this built into grails out of the box would be great. I would not mind doing this by default with any form that is submitted; only if a closure for double form submission is declared, it would execute that logic.

Show
Sven Haiges added a comment - 24/Aug/06 4:18 AM Love it. Double form submission is a big pain and having this built into grails out of the box would be great. I would not mind doing this by default with any form that is submitted; only if a closure for double form submission is declared, it would execute that logic.
Hide
Permalink
Graeme Rocher added a comment - 08/Jan/09 8:07 AM - edited

support for duplicate form submissions (GRAILS-3653 and GRAILS-208 ). You can now specify that a token be added to a form:

<g:form useToken="true">

Then on the server side there is a new withForm method:

withForm {
   // good request
}.invalidToken {
   // bad request
}

A token is stored in the user session and compared to the one submitted in the request thus implementing the "Synchronizer Token Pattern".

Also added default behavior so that if only withForm is specified (and not invalidToken) then the user is redirected back to the original page by default. An "invalidToken" variable is automatically placed within flash.scope so the user can then do this in the view:

<g:if test="${flash.invalidToken}">
   You can't submit twice!
</g:if> 
Show
Graeme Rocher added a comment - 08/Jan/09 8:07 AM - edited support for duplicate form submissions ( GRAILS-3653 and GRAILS-208 ). You can now specify that a token be added to a form: <g:form useToken= " true " > Then on the server side there is a new withForm method: withForm { // good request }.invalidToken { // bad request } A token is stored in the user session and compared to the one submitted in the request thus implementing the "Synchronizer Token Pattern". Also added default behavior so that if only withForm is specified (and not invalidToken) then the user is redirected back to the original page by default. An "invalidToken" variable is automatically placed within flash.scope so the user can then do this in the view: <g: if test= "${flash.invalidToken}" > You can't submit twice! </g: if >
Hide
Permalink
Robert Fischer added a comment - 08/Jan/09 8:54 AM

Did .withForm{} exist before? And is it keyed off of id in case multiple possible forms route to the same action?

Show
Robert Fischer added a comment - 08/Jan/09 8:54 AM Did .withForm{} exist before? And is it keyed off of id in case multiple possible forms route to the same action?
Hide
Permalink
Graeme Rocher added a comment - 08/Jan/09 9:24 AM

No it is new, and no it is not keyed for id at the moment, but I'm struggling to think of a use case where you want to do that

Show
Graeme Rocher added a comment - 08/Jan/09 9:24 AM No it is new, and no it is not keyed for id at the moment, but I'm struggling to think of a use case where you want to do that

People

  • Assignee:
    Graeme Rocher
    Reporter:
    Marc Palmer
Vote (8)
Watch (7)

Dates

  • Created:
    12/Jul/06 6:22 AM
    Updated:
    18/May/11 3:14 PM
    Resolved:
    08/Jan/09 8:07 AM

Agile

  • View on Board
  • Atlassian JIRA (v5.2.1#813-sha1:277a546)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Grails project. Try JIRA - bug tracking software for your team.