Index: /Dev/trunk/src/client/qed-client/model/widgets/SurveyRenderWidget.js
===================================================================
--- /Dev/trunk/src/client/qed-client/model/widgets/SurveyRenderWidget.js	(revision 460)
+++ /Dev/trunk/src/client/qed-client/model/widgets/SurveyRenderWidget.js	(revision 461)
@@ -22,10 +22,10 @@
             this.survey = survey;
             var f = new QuestionWidgetFactory();
-            array.forEach(Survey.Questions.get(this.survey),function(question){
-                array.forEach(question.content || [],function(item,index){
+            array.forEach(Survey.Questions.get(this.survey),function(question,question_index){
+                array.forEach(question.content || [], function(item,item_index){
                     // The dot causes values to be grouped in an object!
-                    item.code = question.code.toString()+'.'+index.toString();
                     var w = f.createViewWidget(item);
                     if ( w !== null ) {
+                        w.name = question_index.toString()+'/'+question.code.toString()+'.'+item_index.toString();
                         w.placeAt(this.domNode);
                     }
Index: /Dev/trunk/src/client/qed-client/model/widgets/questions/MultipleChoiceInputWidget.js
===================================================================
--- /Dev/trunk/src/client/qed-client/model/widgets/questions/MultipleChoiceInputWidget.js	(revision 460)
+++ /Dev/trunk/src/client/qed-client/model/widgets/questions/MultipleChoiceInputWidget.js	(revision 461)
@@ -10,4 +10,5 @@
     return declare([_ComplexValueWidget],{
         templateString: template,
+        allowMultiple: false,
         startup: function() {
             if ( this._started ) { return; }
@@ -20,10 +21,28 @@
                 }, this.domNode, "last");
                 var input = new Ctor({
-                    name: index.toString()
+                    name: this.allowMultiple === true ? index.toString() : 'choice',
+                    value: item.text
                 }).placeAt(div);
                 var label = domConstruct.create("label",{
+                    for: input.id,
                     innerHTML: item.text
                 }, div);
             }, this);
+        },
+        _getValueAttr: function() {
+            var value = this.inherited(arguments);
+            if ( this.allowMultiple === true ) {
+                return value;
+            } else {
+                return value.choice;
+            }
+        },
+        _setValueAttr: function(value) {
+            var inherited = this.getInherited(arguments);
+            if ( this.allowMultiple === true ) {
+                inherited.call(this,value);
+            } else {
+                inherited.call(this,{choice:value});
+            }
         }
     });
Index: /Dev/trunk/src/client/qed-client/model/widgets/questions/TextInputWidget.js
===================================================================
--- /Dev/trunk/src/client/qed-client/model/widgets/questions/TextInputWidget.js	(revision 460)
+++ /Dev/trunk/src/client/qed-client/model/widgets/questions/TextInputWidget.js	(revision 461)
@@ -14,8 +14,8 @@
         },
         _getValueAttr: function() {
-            return this.textBox.get('value');
+            return this.textArea.get('value');
         },
         _setValueAttr: function(value) {
-            return this.textBox.set('value', value);
+            return this.textArea.set('value', value);
         }
     });
Index: /Dev/trunk/src/client/qed-client/model/widgets/questions/templates/HeaderConfigWidget.html
===================================================================
--- /Dev/trunk/src/client/qed-client/model/widgets/questions/templates/HeaderConfigWidget.html	(revision 460)
+++ /Dev/trunk/src/client/qed-client/model/widgets/questions/templates/HeaderConfigWidget.html	(revision 461)
@@ -1,4 +1,4 @@
-<div>
+<form>
   <label for="text" class="qedLabel">Text</label>
   <div class="qedField" data-dojo-type="dijit/form/TextBox" name="text"></div>
-</div>
+</form>
Index: /Dev/trunk/src/client/qed-client/model/widgets/questions/templates/MultipleChoiceInputConfigRowWidget.html
===================================================================
--- /Dev/trunk/src/client/qed-client/model/widgets/questions/templates/MultipleChoiceInputConfigRowWidget.html	(revision 460)
+++ /Dev/trunk/src/client/qed-client/model/widgets/questions/templates/MultipleChoiceInputConfigRowWidget.html	(revision 461)
@@ -1,3 +1,3 @@
-<div>
+<form>
   <div data-dojo-type="dijit/form/ValidationTextBox" name="text" required="required" data-dojo-attach-point="textBox"></div><div data-dojo-type="dijit/form/Button" data-dojo-attach-event="onClick:onDestroy">X</div>
-</div>
+</form>
Index: /Dev/trunk/src/client/qed-client/model/widgets/questions/templates/MultipleChoiceInputConfigWidget.html
===================================================================
--- /Dev/trunk/src/client/qed-client/model/widgets/questions/templates/MultipleChoiceInputConfigWidget.html	(revision 460)
+++ /Dev/trunk/src/client/qed-client/model/widgets/questions/templates/MultipleChoiceInputConfigWidget.html	(revision 461)
@@ -1,3 +1,3 @@
-<div>
+<form>
   <div>
     <label class="qedLabel" for="allowMultiple">Allow multiple</label>
@@ -7,3 +7,3 @@
   </div>
   <div data-dojo-type="dijit/form/Button" data-dojo-attach-event="onClick:onAddItem">Add item</div>
-</div>
+</form>
Index: /Dev/trunk/src/client/qed-client/model/widgets/questions/templates/MultipleChoiceInputWidget.html
===================================================================
--- /Dev/trunk/src/client/qed-client/model/widgets/questions/templates/MultipleChoiceInputWidget.html	(revision 460)
+++ /Dev/trunk/src/client/qed-client/model/widgets/questions/templates/MultipleChoiceInputWidget.html	(revision 461)
@@ -1,2 +1,2 @@
-<div>
-</div>
+<form>
+</form>
Index: /Dev/trunk/src/client/qed-client/model/widgets/questions/templates/NumberInputConfigWidget.html
===================================================================
--- /Dev/trunk/src/client/qed-client/model/widgets/questions/templates/NumberInputConfigWidget.html	(revision 460)
+++ /Dev/trunk/src/client/qed-client/model/widgets/questions/templates/NumberInputConfigWidget.html	(revision 461)
@@ -1,3 +1,3 @@
-<div>
+<form>
   <div>
     <label class="qedLabel" for="text">Item/Question Text</label>
@@ -16,3 +16,3 @@
     <div class="qedField" data-dojo-type="dijit/form/NumberTextBox" data-dojo-props="constraints:{ min: 0 }" name="places"></div>
   </div>
-</div>
+</form>
Index: /Dev/trunk/src/client/qed-client/model/widgets/questions/templates/NumberInputWidget.html
===================================================================
--- /Dev/trunk/src/client/qed-client/model/widgets/questions/templates/NumberInputWidget.html	(revision 460)
+++ /Dev/trunk/src/client/qed-client/model/widgets/questions/templates/NumberInputWidget.html	(revision 461)
@@ -1,4 +1,4 @@
-<div>
+<form>
   <p>${text}</p>
   <div class="qedField" data-dojo-attach-point="numberBox" data-dojo-type="dijit/form/NumberTextBox" name="text"></div>
-</div>
+</form>
Index: /Dev/trunk/src/client/qed-client/model/widgets/questions/templates/ScaleInputConfigWidget.html
===================================================================
--- /Dev/trunk/src/client/qed-client/model/widgets/questions/templates/ScaleInputConfigWidget.html	(revision 460)
+++ /Dev/trunk/src/client/qed-client/model/widgets/questions/templates/ScaleInputConfigWidget.html	(revision 461)
@@ -1,3 +1,3 @@
-<div class="${baseClass}">
+<form class="${baseClass}">
   <table>
     <thead>
@@ -46,3 +46,3 @@
     </tbody>
   </table>
-</div>
+</form>
Index: /Dev/trunk/src/client/qed-client/model/widgets/questions/templates/ScaleInputWidget.html
===================================================================
--- /Dev/trunk/src/client/qed-client/model/widgets/questions/templates/ScaleInputWidget.html	(revision 460)
+++ /Dev/trunk/src/client/qed-client/model/widgets/questions/templates/ScaleInputWidget.html	(revision 461)
@@ -1,3 +1,3 @@
-<div class="${baseClass}">
+<form class="${baseClass}">
   <table>
     <thead>
@@ -12,3 +12,3 @@
     </tbody>
   </table>
-</div>
+</form>
Index: /Dev/trunk/src/client/qed-client/model/widgets/questions/templates/StringInputConfigWidget.html
===================================================================
--- /Dev/trunk/src/client/qed-client/model/widgets/questions/templates/StringInputConfigWidget.html	(revision 460)
+++ /Dev/trunk/src/client/qed-client/model/widgets/questions/templates/StringInputConfigWidget.html	(revision 461)
@@ -1,4 +1,4 @@
-<div>
+<form>
   <label class="qedLabel" for="text">Item/Question Text</label>
   <div class="qedField" data-dojo-attach-point="textBox" data-dojo-type="dijit/form/TextBox" data-dojo-props="placeholder: 'Item/Question Text'" name="text"></div>
-</div>
+</form>
Index: /Dev/trunk/src/client/qed-client/model/widgets/questions/templates/StringInputWidget.html
===================================================================
--- /Dev/trunk/src/client/qed-client/model/widgets/questions/templates/StringInputWidget.html	(revision 460)
+++ /Dev/trunk/src/client/qed-client/model/widgets/questions/templates/StringInputWidget.html	(revision 461)
@@ -1,4 +1,4 @@
-<div>
+<form>
   <p>${text}</p>
   <div data-dojo-attach-point="textBox" data-dojo-type="dijit/form/TextBox" name="text"></div>
-</div>
+</form>
Index: /Dev/trunk/src/client/qed-client/model/widgets/questions/templates/TextConfigWidget.html
===================================================================
--- /Dev/trunk/src/client/qed-client/model/widgets/questions/templates/TextConfigWidget.html	(revision 460)
+++ /Dev/trunk/src/client/qed-client/model/widgets/questions/templates/TextConfigWidget.html	(revision 461)
@@ -1,4 +1,4 @@
-<div>
+<form>
   <label for="text" class="qedLabel">Text</label>
   <textarea class="qedField" data-dojo-type="dijit/form/Textarea" name="text"></textarea>
-</div>
+</form>
Index: /Dev/trunk/src/client/qed-client/model/widgets/questions/templates/TextInputConfigWidget.html
===================================================================
--- /Dev/trunk/src/client/qed-client/model/widgets/questions/templates/TextInputConfigWidget.html	(revision 460)
+++ /Dev/trunk/src/client/qed-client/model/widgets/questions/templates/TextInputConfigWidget.html	(revision 461)
@@ -1,3 +1,3 @@
-<div>
+<form>
   <div>
     <label class="qedLabel" for="text">Item/Question Text</label>
@@ -8,3 +8,3 @@
     <div class="qedField" data-dojo-type="dijit/form/NumberTextBox" data-dojo-props="placeholder: 'Maximum length', constraints: { min: 0 }" name="maxLength"></div>
   </div>
-</div>
+</form>
Index: /Dev/trunk/src/client/qed-client/model/widgets/questions/templates/TextInputWidget.html
===================================================================
--- /Dev/trunk/src/client/qed-client/model/widgets/questions/templates/TextInputWidget.html	(revision 460)
+++ /Dev/trunk/src/client/qed-client/model/widgets/questions/templates/TextInputWidget.html	(revision 461)
@@ -1,4 +1,4 @@
-<div>
+<form>
   <p>${text}</p>
   <div class="qedField" data-dojo-attach-point="textArea" data-dojo-type="dijit/form/Textarea" name="text"></div>
-</div>
+</form>
Index: /Dev/trunk/src/client/qed-client/model/widgets/templates/SurveyRenderWidget.html
===================================================================
--- /Dev/trunk/src/client/qed-client/model/widgets/templates/SurveyRenderWidget.html	(revision 460)
+++ /Dev/trunk/src/client/qed-client/model/widgets/templates/SurveyRenderWidget.html	(revision 461)
@@ -1,2 +1,2 @@
-<div class="${baseClass}">
-</div>
+<form class="${baseClass}">
+</form>
Index: /Dev/trunk/src/client/qed-client/model/widgets/templates/SurveyRunWidget.html
===================================================================
--- /Dev/trunk/src/client/qed-client/model/widgets/templates/SurveyRunWidget.html	(revision 460)
+++ /Dev/trunk/src/client/qed-client/model/widgets/templates/SurveyRunWidget.html	(revision 461)
@@ -1,3 +1,3 @@
-<div class="${baseClass}">
+<form class="${baseClass}">
 
     <div>
@@ -24,3 +24,3 @@
     </div>
 
-</div>
+</form>
Index: /Dev/trunk/src/client/qed-client/model/widgets/templates/SurveyWidget.html
===================================================================
--- /Dev/trunk/src/client/qed-client/model/widgets/templates/SurveyWidget.html	(revision 460)
+++ /Dev/trunk/src/client/qed-client/model/widgets/templates/SurveyWidget.html	(revision 461)
@@ -1,6 +1,6 @@
-<fieldset class="${baseClass}">
+<form class="${baseClass}">
     <label for="title">Title</label>
     <input data-dojo-type="dijit/form/TextBox" name="title"/><br/>
     <label for="description">Description</label>
     <input data-dojo-type="dijit/form/Textarea" name="description"/><br/>
-</fieldset>
+</form>
Index: /Dev/trunk/src/client/qed-client/pages/response.js
===================================================================
--- /Dev/trunk/src/client/qed-client/pages/response.js	(revision 460)
+++ /Dev/trunk/src/client/qed-client/pages/response.js	(revision 461)
@@ -1,3 +1,4 @@
 define([
+    "../app/Content",
     "../app/Page",
     "../lib/async",
@@ -13,5 +14,5 @@
     "require",
     "dojo/text!./templates/response.html"
-], function(Page, async, Response, Survey, SurveyRun, store, declare, event, lang, all, when, require, template) {
+], function(Content, Page, async, Response, Survey, SurveyRun, store, declare, event, lang, all, when, require, template) {
     return declare([Page],{
         contextRequire: require,
@@ -24,10 +25,19 @@
             if ( this._started ) { return; }
             this.inherited(arguments);
-            this._disableButtons();
+            this._disableSubmit();
             var surveyRunId = this.surveyRunId;
             var responseId = this.options && this.options.id;
             if ( surveyRunId && responseId ) {
                 this._loadSurveyAndResponse(surveyRunId,responseId)
-                .then(lang.hitch(this,"_enableButtons"));
+                .then(lang.hitch(this, function() {
+                    if ( this.response.publicationDate ) {
+                        this._showInfo("<div>You already submitted your survey and cannot change it anymore. You can still view your answers here.</div>");
+                        this._disableSubmit();
+                    } else {
+                        this._enableSubmit();
+                    }
+                }), function() {
+                    this._showInfo("<div>The url seems to be incorrect, no survey found.</div>");
+                });
             } else {
                 throw new Error("No valid uid or survey passed!");
@@ -43,31 +53,45 @@
                 }
                 this.titleNode.innerHTML = Survey.DisplayTitle.get(surveyRun.survey);
-                this.surveyWidget.set('survey',surveyRun.survey);
-                this.responseForm.set('value',this.response.answers || {});
+                this.surveyWidget.set('survey', surveyRun.survey);
+                this.surveyWidget.set('value', this.response.answers || {});
             }));
         },
-        _enableButtons: function() {
+        _enableSubmit: function() {
             this.submitButton.set('disabled',false);
             this.continueButton.set('disabled',false);
+            this.surveyWidget.set('disabled', false);
         },
-        _disableButtons: function() {
+        _disableSubmit: function() {
             this.submitButton.set('disabled',true);
             this.continueButton.set('disabled',true);
+            this.surveyWidget.set('disabled', true);
+        },
+        _showInfo: function(html) {
+            this.infoNode.innerHTML = html;
         },
         _getAnswersAndSaveResponse: function() {
-            this.response.answers = this.responseForm.get('value');
-            console.log(this.response);
-            return store.put(this.response);
+            var answers = this.surveyWidget.get('value');
+            this.response.answers = answers;
+            return store.put(this.response).then(function(){
+                Content.notify("Your response is saved.");
+            }, function(err){
+                Content.notify(err,'error');
+            });
         },
         _onSubmit: function(e) {
             this.response.publicationDate = store.timestamp();
-            this._getAnswersAndSaveResponse();
-            this.content.domNode.innerHTML = "<div>Thanks for filling in the survey.</div>";
+            this._getAnswersAndSaveResponse()
+            .then(function(){
+                this._showInfo("<div>Thanks for filling in the survey. You cannot edit your answers anymore.</div>");
+                this._disableSubmit();
+            });
             if ( e ) { event.stop(e); }
             return false;
         },
         _onContinueLater: function(e) {
-            this._getAnswersAndSaveResponse();
-            this.content.domNode.innerHTML = "<div>To continue with this survey later, just save the URL in the location bar and revisit it later. Your answers will still be there.</div>";
+            this._getAnswersAndSaveResponse()
+            .then(lang.hitch(this,function(){
+                this._showInfo("<div>To continue with this survey later, just save the URL in the location bar and revisit it later. Your answers will still be there.</div>");
+            }));
             if ( e ) { event.stop(e); }
             return false;
Index: /Dev/trunk/src/client/qed-client/pages/templates/response.html
===================================================================
--- /Dev/trunk/src/client/qed-client/pages/templates/response.html	(revision 460)
+++ /Dev/trunk/src/client/qed-client/pages/templates/response.html	(revision 461)
@@ -6,11 +6,9 @@
             <span class="headerText" data-dojo-attach-point="titleNode">Survey</span>
         </h2>
+        <div data-dojo-attach-point="infoNode"></div>
     </div>
     
     <div data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'center'" data-dojo-attach-point="content">
-        <form data-dojo-type="dijit/form/Form" data-dojo-attach-point="responseForm"
-              data-dojo-attach-event="onSubmit:_ignoreEvent" style="overflow: auto">
-            <div data-dojo-type="../model/widgets/SurveyRenderWidget" data-dojo-attach-point="surveyWidget"></div>
-        </form>
+        <div name="answers" data-dojo-type="../model/widgets/SurveyRenderWidget" data-dojo-attach-point="surveyWidget"></div>
     </div>
     
Index: /Dev/trunk/src/client/qed-client/store/CouchStore.js
===================================================================
--- /Dev/trunk/src/client/qed-client/store/CouchStore.js	(revision 460)
+++ /Dev/trunk/src/client/qed-client/store/CouchStore.js	(revision 461)
@@ -12,5 +12,5 @@
         var reason = err.response &&
                      err.response.data &&
-                     json.fromJson(err.response.data).reason;
+                     err.response.data.reason;
         return reason || "Unknown error.";
     }
Index: /Dev/trunk/src/client/qed-client/widgets/_ComplexValueMixin.js
===================================================================
--- /Dev/trunk/src/client/qed-client/widgets/_ComplexValueMixin.js	(revision 460)
+++ /Dev/trunk/src/client/qed-client/widgets/_ComplexValueMixin.js	(revision 461)
@@ -3,6 +3,7 @@
     "dijit/form/_FormMixin",
     "dojo/_base/array",
-    "dojo/_base/declare"
-], function(_Container, _FormMixin, array, declare) {
+    "dojo/_base/declare",
+    "dojo/_base/event"
+], function(_Container, _FormMixin, array, declare, event) {
     return declare([_Container,_FormMixin],{
         name: "",
@@ -10,4 +11,10 @@
         disabled: false,
         readOnly: false,
+        postCreate: function() {
+            this.inherited(arguments);
+            if ( this.domNode.tagName.toLowerCase() !== "form" ) {
+                console.warn("Not scoping a _ComplexValueMixin in a form element can cause name clashes. E.g. radio buttons might stop working correctly. It is recommended to use <form> as the root element in your template for "+this.declaredClass+".");
+            }
+        },
         _setDisabledAttr: function(value) {
             this._set("disabled", value);
@@ -27,4 +34,18 @@
                 children[0].focus();
             }
+        },
+        onSubmit: function(e) {
+            // since this widget is used to create more complex
+            // widgets within other forms, the onSubmit must either be
+            // ignored or propagated, but not handled here.
+            if ( e ) { event.stop(e); }
+            return false;
+        },
+        _onSubmit: function(e) {
+            // since this widget is used to create more complex
+            // widgets within other forms, the onSubmit must either be
+            // ignored or propagated, but not handled here.
+            if ( e ) { event.stop(e); }
+            return false;
         }
     });
