NetTalk Central
NetTalk Web Server => Web Server - Ask For Help => Topic started by: willieb on January 30, 2014, 02:00:47 AM
-
Hi, is there a way to disable the save button after clicking on it?
I have a Memory form with the normal save & cancel buttons. When save is clicked I do some validations(ValidateAllStart). Then at (ValidateAllEnd) embed I add a record to a table, after adding I give the user a popup to show the record have been added.
What happens now is the user click once, then after a second nothing happened, then clicks again, and again ... then the record get added more than once. The problem is their network/internet is very slow.
Is there a way to disable or even hide the save button after the first click?
Or any other suggestions to fix my problem?
-
I have the same issue. Try adding this code to your xhtml tab of the form, and set the location to "Before <form>"
<script>$("button[name=save_btn]").one("click", function() {
$(this).attr("disabled","disabled");
});
</script>
Hope that helps,
Debra
-
Thank will try and let you know.
In the mean time I added a normal button which call another form just to display "busy processing" while waiting for the server, and returning when done. The saving/processing is done on the "busy processing" form.
-
I'll add this to an upcoming build.
...and I think there's a typo in Dbra's example, should be on('click') not one('click')
-
Thanks Bruce
-
No not a typo, makes it so the event only fires once, even if it is clicked again.
http://api.jquery.com/one/
-
ahh - thanks Debra - hadn't come across that one before....