Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to avoid multiple submit on form

 
Shakti Sharma
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to avoid multiple submit on form. I am using token pattern. I am able to catch the duplicate request and able to redirect it to error
Page, but my problem is even though page shows the error message but it keeps on waiting for further response, I don’t know for what it waits for after displaying the error page, my understanding is it waits for response of first request, if this is true then how to avoid this??
 
Mark Stein
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One way to stop multiple submits is from the page itself, using javascript. Initial a boolean value to false, and on submit, set it to true. Use that boolean as a test when you submit... this way you can limit the actual request to one.
MS
 
Ronald Francis
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
MS , the Javascript fix doesn't work 100% .Have been working on this recently , and if you click fast enough , duplicate requests do go in.
 
Ronald Francis
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Shakti ,
The browser waits for the response of the most recent request ...Are you sure that you are sending in the error page in response to the last (most recent) request and not the second ?
My test implemention of the token pattern worked fine..
Cheers
ROnald
 
Shakti Sharma
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I agree with you that browser waits for most recent response, thats what is not happing here. When first request passed token check, second request fails at token check and I am redirecting it to error page. Borowser loads error page sucessfuly but keeps on waiting for further response.
 
Shakti Sharma
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That was problem with debug mode, I changed mode and its working fine.
Thanks
 
eric sato
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
What i can suggest by using session control. Once the first submit being submitted, check the session whether is "TRUE" , if no, set the session object to "TRUE", else error.
Regards,
eric sato
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic