]> git.openstreetmap.org Git - rails.git/commitdiff
Disable buttons while form submission is in progress
authorTom Hughes <tom@compton.nu>
Tue, 16 Oct 2012 11:23:27 +0000 (12:23 +0100)
committerTom Hughes <tom@compton.nu>
Tue, 16 Oct 2012 11:23:27 +0000 (12:23 +0100)
app/assets/javascripts/index/notes.js.erb

index 8b440910c6105aa050538ed3ae311237f12933bd..5ecaca7dd61c3f20d3db0eff4dbc4eca16f7a8a5 100644 (file)
@@ -20,6 +20,8 @@ $(document).ready(function () {
   function createNote(feature, form) {
     var location = unproj(feature.geometry.getBounds().getCenterLonLat());
 
   function createNote(feature, form) {
     var location = unproj(feature.geometry.getBounds().getCenterLonLat());
 
+    $(form).find("input[type=submit]").prop("disabled", true);
+
     $.ajax($("#createnoteanchor").attr("href"), {
       type: "POST",
       data: {
     $.ajax($("#createnoteanchor").attr("href"), {
       type: "POST",
       data: {
@@ -42,6 +44,8 @@ $(document).ready(function () {
   function updateNote(feature, form, close) {
     var url = close ? feature.attributes.close_url : feature.attributes.comment_url;
 
   function updateNote(feature, form, close) {
     var url = close ? feature.attributes.close_url : feature.attributes.comment_url;
 
+    $(form).find("input[type=submit]").prop("disabled", true);
+
     $.ajax(url, {
       type: "POST",
       data: {
     $.ajax(url, {
       type: "POST",
       data: {