Details

    • Type: Sub-task Sub-task
    • Status: 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

          Activity

          Hide
          Sven Haiges added a comment -

          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 - 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
          Graeme Rocher added a comment - - 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 - - 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
          Robert Fischer added a comment -

          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 - Did .withForm{} exist before? And is it keyed off of id in case multiple possible forms route to the same action?
          Hide
          Graeme Rocher added a comment -

          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 - 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
            • Votes:
              8 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development