Solved

asp.net mvc4

Posted on 2015-02-16
3
120 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
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…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

717 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