Last post Mar 17, 2018 04:04 AM by ryanbesko
Mar 13, 2018 11:13 AM|ManDown|LINK
I'm working on project in MVC5 and I have page (Requestapplication.cshtml) , which User Submit form and than when they submitted, it will go to another page (ProcessRequest.cshtml),which take care of Process and also show a message to User for ex:.your application
enabled for everyone if they have not tried before.
<form id="RMAForm" method="post" action="/Account/ProcessRequest">
//some input field
<button id="btn" type="submit" class="btn btn-info btn-fill btn-wd">Send</button>
Can anyone point me into right direction ?! thanks
Mar 14, 2018 07:00 AM|Eric Du|LINK
According to your description and needs, please check the following sample code:
<button id="btn" type="submit" class="btn btn-info btn-fill btn-wd" onclick="this.disabled='true';return true;this.value='Submitting...'; this.form.submit();">Send</button>
Mar 15, 2018 02:45 PM|ManDown|LINK
Hi Eric .
I tried the code , but when i click on button,it cannot post the Data!!
Mar 16, 2018 01:56 AM|Eric Du|LINK
According to your needs, as far as i know, you could try use some jQuery plugin or jQuery Code to prevent double form submit, please check:
Simple double form submission prevention with jQuery:
Disabling the Submit Button to Prevent Double Form Submission:
Mar 16, 2018 09:14 AM|yogyogi|LINK
You can store a value on the session variable which will identify whether the button has been previously clicked. If it is previously clicked then simply disable it on the view.
Mar 16, 2018 11:28 PM|ManDown|LINK
Mar 16, 2018 11:36 PM|ManDown|LINK
Mar 17, 2018 04:04 AM|ryanbesko|LINK
Always have the your form controller check your database to see if the processing has already been done. If yes, do some if then stuff in your Razor view to disable the button. I suggest instead to display a message or direct them to a different page from
the controller before it even sends the form to the browser.