]> git.openstreetmap.org Git - osqa.git/commitdiff
disabling the submit buttons for question and answers.
authorcourt <court@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Tue, 17 Aug 2010 15:04:43 +0000 (15:04 +0000)
committercourt <court@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Tue, 17 Aug 2010 15:04:43 +0000 (15:04 +0000)
git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@557 0cfe37f9-358a-4d5e-be75-b63607b5c754

forum/skins/default/templates/ask.html
forum/skins/default/templates/question.html

index c17ea51dedf07b1d65223175881219c513c9e07a..6be8f59e9f74c1836538195020fe91bf4ef8ddd3 100644 (file)
         }
         window.addEventListener('beforeunload', beforeUnload, true);
 
+        function submitClicked() {
+            window.removeEventListener('beforeunload', beforeUnload, true);
+            $("input.submit").each(function() {
+                this.disabled=true;
+            });
+        }
+
         var related_questions_url = "{% url related_questions %}";
         </script>
         <script src="{% media "/media/js/osqa.ask.js" %}" type="text/javascript"></script>
             {% if not request.user.is_authenticated %}
             <input name="ask" type="submit" value="{% trans "Login/signup to post your question" %}" class="submit" />
                        {% else %}
-            <input name="ask" type="submit" value="{% trans "Ask your question" %}" class="submit" onclick="window.removeEventListener('beforeunload', beforeUnload, true)" />
+            <input name="ask" type="submit" value="{% trans "Ask your question" %}" class="submit" onclick="submitClicked()" />
             {% endif %}
         </form>
     </div>
index efc5f5ee189d59c90b5492c27c7a16ae7a61188f..a9a170608a036ac8df4d873040d8ff655adf3eab 100644 (file)
         }\r
         window.addEventListener('beforeunload', beforeUnload, true);\r
 \r
-        </script>\r
+        function submitClicked() {\r
+             window.removeEventListener('beforeunload', beforeUnload, true);\r
+             $("input.submit").each(function() {\r
+                 this.disabled=true;\r
+             });\r
+         }\r
+\r
+         </script>\r
         <noscript>\r
             <style>\r
                 .comment.not_top_scorer {\r
                     <div id="previewer" class="wmd-preview"></div>                    \r
                 </div>\r
                 <p><span class="form-error"></span></p>\r
-                <input type="submit" \r
+                <input type="submit"\r
                     {% if user.is_anonymous %}\r
                         value="{% trans "Login/Signup to Post Your Answer" %}" \r
                     {% else %}\r
                         value="{% trans "Answer the question" %}" \r
                         {% endif %}\r
                     {% endif %}\r
-                    class="submit" style="float:left" onclick="window.removeEventListener('beforeunload', beforeUnload, true)" />\r
+                    class="submit" style="float:left" onclick="submitClicked()" />\r
             {% endif %}\r
         </form>\r
     </div>\r