Resolve "Disable 2nd click on new JO submission" #903
1 changed files with 10 additions and 0 deletions
|
|
@ -802,6 +802,8 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
$(function() {
|
$(function() {
|
||||||
|
var form_in_process = false;
|
||||||
|
|
||||||
// BEGIN google maps stuff
|
// BEGIN google maps stuff
|
||||||
function selectPoint(map, latlng) {
|
function selectPoint(map, latlng) {
|
||||||
var lat = latlng.lat();
|
var lat = latlng.lat();
|
||||||
|
|
@ -899,6 +901,13 @@ $(function() {
|
||||||
// END google maps stuff
|
// END google maps stuff
|
||||||
|
|
||||||
$("#row-form").submit(function(e) {
|
$("#row-form").submit(function(e) {
|
||||||
|
if (form_in_process) {
|
||||||
|
alert("Cannot submit form twice. First submission still in progress.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
form_in_process = true;
|
||||||
|
|
||||||
var form = $(this);
|
var form = $(this);
|
||||||
|
|
||||||
// get all fields, including disabled ones
|
// get all fields, including disabled ones
|
||||||
|
|
@ -938,6 +947,7 @@ $(function() {
|
||||||
});
|
});
|
||||||
}).fail(function(response) {
|
}).fail(function(response) {
|
||||||
if (response.status == 422) {
|
if (response.status == 422) {
|
||||||
|
form_in_process = false;
|
||||||
var errors = response.responseJSON.errors;
|
var errors = response.responseJSON.errors;
|
||||||
var firstfield = false;
|
var firstfield = false;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue