Solved

asp.net mvc4

Posted on 2015-02-16
3
113 Views
Last Modified: 2015-02-17
Hi All,

I Implemented webapp with asp.net mvc4.

I have form with submit button that when users click on it they save all the data they filled up in the form. what I would like to do is when user click on submit then submit will grey out or disable until the process of saving data finish. The issue I experience now is users click on submit many times and created duplicated data.

Here is what I was trying to do:

this.disabled = true; this.value = 'Creating PO, please wait....'; this.form.submit()

This code above works but he doesn't save all my form as in my server side i need to pass param.

Here is my submit button:

<input type="submit" name="command" value="Submit" id="Submit" class="btn btn-sm btn-primary" />
0
Comment
Question by:Moti Mashiah
3 Comments
 
LVL 96

Expert Comment

by:Bob Learned
Comment Utility
If you are concerned with multiple submits, you could also do a redirect to an action, which will lose track of the post.

Redirect After Post
http://www.theserverside.com/news/1365146/Redirect-After-Post
0
 
LVL 25

Accepted Solution

by:
apeter earned 500 total points
Comment Utility
Hope below jquery helps you. It displays an alert on second click. Or  you can change the code to do something else if you want.

var tryNumber = 0;
 jQuery('input[type=submit]').click(function (event) {
     var self = $(this);

     if (self.closest('form').valid()) {
         if (tryNumber > 0) {
             tryNumber++;
             alert('Your form has been already submited. wait please');
             return false;
         }
         else {
             tryNumber++;
         }
     };
 });
0
 
LVL 1

Author Closing Comment

by:Moti Mashiah
Comment Utility
thanks solved
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
sites similar to codingbat to improve coding hanson skills 3 19
asp.net bundle 8 32
getting id from database 5 23
Hide Tab Page 3 18
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
This video teaches viewers about errors in exception handling.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now