Index: /Dev/branches/jos-branch/js/questionEditorScripts.js
===================================================================
--- /Dev/branches/jos-branch/js/questionEditorScripts.js	(revision 239)
+++ /Dev/branches/jos-branch/js/questionEditorScripts.js	(revision 240)
@@ -24,5 +24,4 @@
     // Properties    
     this.uid = null;    // The uid of the question contained in this editor
-    this.saved = false; // Whether or not the question displayed in the editor has been saved already.
     var me = this;      // Retarded self-reference because: Javascript
     this.element = null;    // The parent div element containing the questionEditor
@@ -72,5 +71,5 @@
         }
     }
-    this.init = function() {
+    this.init = function(uid) {
         // Outer div
         this.saved = false;
@@ -78,5 +77,5 @@
         me.element.className = "smallFrame questionEditor";
         me.element.id = sequencer.state.selectedObject.uid;
-        me.uid = sequencer.state.selectedObject.uid;
+        me.uid = uid;
         // Header
         var titleDiv = ce("div");
@@ -176,5 +175,6 @@
             "title": ge("qeTitleField").innerHTML, 
             "code": ge("qeCodeField").value, 
-            "description": ge("qeBodyTextField").value
+            "description": ge("qeBodyTextField").value,
+            "uid": me.uid
         }
         
@@ -221,4 +221,5 @@
             // Then add the returned uid, if existing, to the sequencer.survey.questions array and set it for update
             debugger;
+            console.log(result.responseText);
             var response = JSON.parse(result.responseText);
             console.log(response);
@@ -250,11 +251,10 @@
     }
     this.discard = function() {
-            debugger;
-            me.element.parentNode.removeChild(me.element);
-            me.init();
-            sequencer.state.loaded = true;
-            sequencer.state.editing = false;
-            sequencer.survey.questions.upToDate[sequencer.survey.questions.uids.indexOf(me.uid)] = false;
-            updateSequencer();
+        debugger;
+        me.element.parentNode.removeChild(me.element);
+        sequencer.state.loaded = true;
+        sequencer.state.editing = false;
+        sequencer.survey.questions.upToDate[sequencer.survey.questions.uids.indexOf(me.uid)] = false;
+        updateSequencer();
         
     }
@@ -476,5 +476,5 @@
             uid: uid
         });
-        me.init();
+        me.init(uid);
         var oldElement = ge(uid);
         if (oldElement) {
@@ -494,5 +494,5 @@
         sequencer.state.editing = true;
     
-        me.reset();
+        me.init(null);
         var container = ge("seqContentWrapper");
         container.appendChild(me.element);
Index: /Dev/branches/jos-branch/js/sequencerScripts.js
===================================================================
--- /Dev/branches/jos-branch/js/sequencerScripts.js	(revision 239)
+++ /Dev/branches/jos-branch/js/sequencerScripts.js	(revision 240)
@@ -178,8 +178,8 @@
 
     /*
-         * Description:
-         * This function updates the visual elements in the sequencer content view to match the current state of the sequencer.session.pipeline property.
-         * It queries the database for object properties via AJAX (returnStep/Display/.php), then inserts divider div's in between where needed.
-         */
+     * Description:
+     * This function updates the visual elements in the sequencer content view to match the current state of the sequencer.session.pipeline property.
+     * It queries the database for object properties via AJAX (returnStep/Display/.php), then inserts divider div's in between where needed.
+     */
         
     switch (sequencer.settings.content.contentType.toLowerCase()) {
@@ -262,5 +262,5 @@
         }
         updateDividers();
-    // End optional
+        // End optional
     }
 }
@@ -325,18 +325,20 @@
         
         // Optional bit with the loading GIF
-        for (var i = 0; i < needsUpdating.length; i++) {
-            var loadingDiv = ce("div");
-            loadingDiv.className = "displayStep loading";
-            loadingDiv.innerHTML = "<img src='images/ui/ajax-loader-round.gif' />";
-            if (needsUpdating[i][0] > sequencer.state.numSteps-1) {
-                content.appendChild(loadingDiv);
-                sequencer.state.numSteps++;
-            }
-            else {
-                content.replaceChild(loadingDiv, content.childNodes[i][0]*2);
+        if (sequencer.settings.content.contentType.toLowerCase() != "survey"){
+            for (var i = 0; i < needsUpdating.length; i++) {
+                var loadingDiv = ce("div");
+                loadingDiv.className = "displayStep loading";
+                loadingDiv.innerHTML = "<img src='images/ui/ajax-loader-round.gif' />";
+                if (needsUpdating[i][0] > sequencer.state.numSteps-1) {
+                    content.appendChild(loadingDiv);
+                    sequencer.state.numSteps++;
+                }
+                else {
+                    content.replaceChild(loadingDiv, content.childNodes[i][0]*2);
+                }
             }
         }
         updateDividers();
-    // End optional
+        // End optional
         
     }
@@ -441,10 +443,10 @@
 function insertNewSteps(response, needsUpdating) {
     /*
-         * This is a function displaying how to handle the visual object representation in solely javascript.
-         * Communication of relevant variables between PHP and JS happens in JSON format.
-         * PHP returns a JSON array of objects to be created by JS
-         * JS then loops through this array and creates DIVS to be inserted into the sequencer.
-         * These are inserted at the position needsUpdating gives us.
-         */
+     * This is a function displaying how to handle the visual object representation in solely javascript.
+     * Communication of relevant variables between PHP and JS happens in JSON format.
+     * PHP returns a JSON array of objects to be created by JS
+     * JS then loops through this array and creates DIVS to be inserted into the sequencer.
+     * These are inserted at the position needsUpdating gives us.
+     */
     if (!response || !response.length > 0) return;
     //console.log(response);
@@ -760,5 +762,5 @@
     newAjaxRequest(requestString, "savesession.php", function(result){
         console.log(result.responseText);
-        }, true);
+    }, true);
 }
 
@@ -838,9 +840,9 @@
     
      
-// The alternative is to use event bubbling to capture the event on a higher level.
-// Basically, we bind a super-structure onclick event that uses e.target|| event.srcElement to determine which element to move and select.
-// http://stackoverflow.com/questions/29624/how-to-maintain-correct-javascript-event-after-using-clonenodetrue
-// Pro: clean implementation, less events binded.
-// Con: Difficult, this already works fine, probably tougher to use in conjunction with multifunctionality (sessions, surveys, questionsets, etc in one kind of editor)
+    // The alternative is to use event bubbling to capture the event on a higher level.
+    // Basically, we bind a super-structure onclick event that uses e.target|| event.srcElement to determine which element to move and select.
+    // http://stackoverflow.com/questions/29624/how-to-maintain-correct-javascript-event-after-using-clonenodetrue
+    // Pro: clean implementation, less events binded.
+    // Con: Difficult, this already works fine, probably tougher to use in conjunction with multifunctionality (sessions, surveys, questionsets, etc in one kind of editor)
      
 }
@@ -864,15 +866,15 @@
     // Derp, natuurlijk werkt de addQuestion call niet twee keer. Hij creeert twee keer exact hetzelfde object. Bottom line: het werkt. Nu de editing code voor deze questions gaan schrijven!
     var response = [{
-        uid: "1234567890testuid",
-        title: "dummyQuestion",
-        description: "This is a dummy question, not a real one!",
-        type: "question"
-    }];
+            uid: "1234567890testuid",
+            title: "dummyQuestion",
+            description: "This is a dummy question, not a real one!",
+            type: "question"
+        }];
     
     var needsUpdating = [[
-    0,
-    "1234567890testuid",
-    "question"
-    ]];
+            0,
+            "1234567890testuid",
+            "question"
+        ]];
     
     insertNewQuestions(response, needsUpdating);
Index: /Dev/branches/jos-branch/setQuestion.php
===================================================================
--- /Dev/branches/jos-branch/setQuestion.php	(revision 239)
+++ /Dev/branches/jos-branch/setQuestion.php	(revision 240)
@@ -13,5 +13,5 @@
     $question_results = Question::get(array("uid" => $input->uid));
     if (!empty($question_results)) {
-        $question = $questions[0];
+        $question = $question_results[0];
     } else {
         die("Error: attempt to edit a non-existing database object!");
@@ -22,6 +22,6 @@
     if ($input->title) $question->title = $input->title;
     if ($input->description) $question->description = $input->description;
-    if ($input->category ) $question->category = null;
-    if ($input->answers) $question->answers = null;
+    if (isset($input->category) ) $question->category = null;
+    if (isset($input->answers)) $question->answers = null;
     $question->save();
     $outputArray = array("created"=>false, "uid"=>$question->uid);
