Results 1 to 3 of 3

Thread: WebUtils.hasSubmitParameter is false if I disable submit button

  1. #1

    Default WebUtils.hasSubmitParameter is false if I disable submit button

    During the onsubmit event of a form, we are disabling the submit button so the user can't click it twice (which causes all sorts of issues).
    The problem is, once disabled, the function hasSubmitParameter() is always returning false in our controller code. We have multiple submit buttons, so we use this function to determine which was clicked and proceed accordingly.
    Has anyone found a way around this?

  2. #2
    Join Date
    May 2005
    Posts
    288

    Default

    How about using window.setTimeout and disabling the buttons 2 seconds after the submit? On the other hand your code should be able to deal with a double submit. One simple way is to create a "form id" as hidden form field, that is read from the request and put into the session. If the incoming request has the same form id as the last request, just block it.

    HTH

  3. #3

    Default

    The setTimeout was considered as a solution and tested (works), but it seems inelegant as there won't be a concise time that we can guarantee the form has been submit (and if we set the timeout too long, then it doesn't give us enough protection).
    Yes, protecting against this on server side is best practice, at least from a data integrity standpoint. The tokenizer approach you mention is probably what we will do at some point. However, this requires modifications to each JSP as well as controller, which is just not viable at this point in the scope of our project.

    But along those lines, how do you simply "reject" a duplicate request from the controller such that it doesn't interfere with the user's experience? I.E. how can I have the controller completely ignore the duplicate request and not attempt to return a view as if it had never happened?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •