Skip to content

Removing ajax handler from submission-button #181

Closed
wants to merge 1 commit into from
View
9 resources/public/script/codebox.js
@@ -22,7 +22,8 @@ var CodeBox = {
this.setupEditor();
}
- this.submitButtons.live("click", $.proxy(this.run, this));
+ $("#run-button").live("click", $.proxy(this.run, this));
+ $("#submission-button").live("click", $.proxy(this.submitProblem, this));
},
setupEditor: function() {
@@ -58,6 +59,12 @@ var CodeBox = {
$("#code-div").toggle('fast');
},
+ submitProblem: function(e) {
+ e.preventDefault();
+ $("#code-box").val(this.getCode());
+ $("#code-box").closest("form").submit();
+ },
+
run: function(e) {
e.preventDefault();
View
1 src/foreclojure/problems.clj
@@ -305,6 +305,7 @@ Return a map, {:message, :error, :url, :num-tests-passed}."
[:p#instruct "Code which fills in the blank: "]
(when (wants-no-javascript-codebox?) [:span#disable-javascript-codebox])
(text-area {:id "code-box"
+ :name "code"
:spellcheck "false"}
:code (escape-html
(or (session/flash-get :code)
Something went wrong with that request. Please try again.