Solved

asp.net mvc4

Posted on 2015-02-16
3
116 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
ID: 40614206
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
ID: 40614604
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
ID: 40614920
thanks solved
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

821 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