Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hello,
I have one form. Coded like below :
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage @using System; @using System.Linq; @using System.Net.Mail; @{ if (IsPost) { //Other code to submit form } } <body> <div > <div> <form method="post" autocomplete="off"> <table class="FormTable"> <tbody> <tr> <td> Your Name <span style="color: #ff0000;">*</span> </td> <td> : </td> <td> <input name="txtyourname" type="text" maxlength="50" id="txtyourname" class="InputTextBox" required /><br /> <span id="Rqfullname" class="Error" style="visibility:hidden;">Please enter Your Name</span> </td> <td> Designation </td> <td> : </td> <td> <input name="txtdesignation" type="text" maxlength="50" id="txtdesignation" class="InputTextBox" /> </td> </tr> <tr> <td>   </td> <td>   </td> <td style="text-align: right"> <input type="submit" name="btnsubmit" value="Submit" id="btnsubmit" class="SubmitBtn" /> </td> <td style="text-align: left"> <input type="reset" name="Butreset" value="Reset" id="Butreset" class="SubmitBtn" /> </td> <td>   </td> <td>   </td> </tr> </tbody> </table> </form> </div> </div> </body>
Form is getting submit properly, But now I want that that when it enter into IsPost then submit button should get disable(double click prevent). Not able to find method for it.
Help me with how to do it.
Thanks,
Dipa
You can do this using Javascript, the quickest, easiest (and dirtiest) way is to add an onlick event to the submit button
<input type="submit" name="btnsubmit" value="Submit" id="btnsubmit" class="SubmitBtn" onclick="this.disabled = true;document.getElementById("myForm").submit()" />
you will also need to add a name to the form
<form method="post" name="myForm" autocomplete="off">
As I said before this is a bit quick and dirty. I would recommend using jquery to do this properly
http://www.w3schools.com/jquery/
But the above way shows the right ideas.
https://www.google.nl/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=mvc%20prevent%20double%20post
http://stackoverflow.com/questions/27927647/prevent-double-submit-post-on-asp-net-mvc-page
Thanks for help.
I found solution with this also.
$(document).on('submit', 'form', function () { document.getElementById("btnsubmit").disabled = true; });
Thanks
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Prevent button double click event in IsPost
Hello,
I have one form. Coded like below :
Form is getting submit properly, But now I want that that when it enter into IsPost then submit button should get disable(double click prevent). Not able to find method for it.
Help me with how to do it.
Thanks,
Dipa
You can do this using Javascript, the quickest, easiest (and dirtiest) way is to add an onlick event to the submit button
you will also need to add a name to the form
As I said before this is a bit quick and dirty. I would recommend using jquery to do this properly
http://www.w3schools.com/jquery/
But the above way shows the right ideas.
https://www.google.nl/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=mvc%20prevent%20double%20post
http://stackoverflow.com/questions/27927647/prevent-double-submit-post-on-asp-net-mvc-page
Hello,
Thanks for help.
I found solution with this also.
Thanks
is working on a reply...