Index: Dev/trunk/src/client/qed-client/css/model/widgets/MultipleChoiceWidget.less
===================================================================
--- Dev/trunk/src/client/qed-client/css/model/widgets/MultipleChoiceWidget.less	(revision 508)
+++ Dev/trunk/src/client/qed-client/css/model/widgets/MultipleChoiceWidget.less	(revision 508)
@@ -0,0 +1,7 @@
+#rft.claro .qedMultipleChoiceWidget {
+    .subcode {
+        &.dijitTextBox {
+            width: 4em;
+        }
+    }
+}
Index: Dev/trunk/src/client/qed-client/model/widgets/QuestionEditorPreviewItem.js
===================================================================
--- Dev/trunk/src/client/qed-client/model/widgets/QuestionEditorPreviewItem.js	(revision 506)
+++ Dev/trunk/src/client/qed-client/model/widgets/QuestionEditorPreviewItem.js	(revision 508)
@@ -103,10 +103,12 @@
         },
         _showViewWidget: function() {
-            var newWidget = this._factory.createViewWidget( this.value );
+            // we pass an empty code, just in case the widget depends
+            // on it,but we don't know the actual code here.
+            var newWidget = this._factory.createViewWidget( lang.mixin({code:""},this.value) );
             if ( newWidget !== null ) {
                 this._destroyInnerWidget();
                 this.innerWidget = newWidget;
+                this.innerWidget.set('readOnly',true);
                 this.addChild(this.innerWidget);
-                this.innerWidget.set('readOnly',true);
                 this.titleNode.innerHTML = this.value.type+" [preview]";
                 domClass.replace(this.editButton.iconNode, "rftIconEdit", "rftIconAccept");
@@ -120,7 +122,7 @@
                 this._destroyInnerWidget();
                 this.innerWidget = newWidget;
-                this.addChild(this.innerWidget);
                 this.innerWidget.set('readOnly',this.readOnly);
                 this.innerWidget.set('disabled',this.disabled);
+                this.addChild(this.innerWidget);
                 this.titleNode.innerHTML = this.value.type+" [editing]";
                 domClass.replace(this.editButton.iconNode, "rftIconAccept", "rftIconEdit");
Index: Dev/trunk/src/client/qed-client/model/widgets/SurveyRenderWidget.js
===================================================================
--- Dev/trunk/src/client/qed-client/model/widgets/SurveyRenderWidget.js	(revision 506)
+++ Dev/trunk/src/client/qed-client/model/widgets/SurveyRenderWidget.js	(revision 508)
@@ -21,11 +21,11 @@
             this.survey = survey;
             var f = new QuestionWidgetFactory();
-            array.forEach(this.survey.questions,function(question,question_index){
-                array.forEach(question.content || [], function(item,item_index){
-                    // The dot causes values to be grouped in an object!
+            array.forEach(this.survey.questions,function(question){
+                array.forEach(question.content || [], function(item){
+                    item.code = question.code;
                     var w = f.createViewWidget(item);
                     if ( w !== null ) {
-                        w.name = question_index.toString()+'/'+question.code.toString()+'.'+item_index.toString();
                         w.placeAt(this.domNode);
+                        w.startup();
                     }
                 },this);
Index: Dev/trunk/src/client/qed-client/model/widgets/questions/MultipleChoiceInputWidget.js
===================================================================
--- Dev/trunk/src/client/qed-client/model/widgets/questions/MultipleChoiceInputWidget.js	(revision 506)
+++ Dev/trunk/src/client/qed-client/model/widgets/questions/MultipleChoiceInputWidget.js	(revision 508)
@@ -1,4 +1,7 @@
 define([
-    "../../../widgets/_ComplexValueWidget",
+    "dijit/_Container",
+    "dijit/_TemplatedMixin",
+    "dijit/_WidgetBase",
+    "dijit/_WidgetsInTemplateMixin",
     "dijit/form/CheckBox",
     "dijit/form/RadioButton",
@@ -7,8 +10,7 @@
     "dojo/dom-construct",
     "dojo/text!./templates/MultipleChoiceInputWidget.html"
-], function(_ComplexValueWidget, CheckBox, RadioButton, array, declare, domConstruct, template) {
-    return declare([_ComplexValueWidget],{
+], function(_Container, _TemplatedMixin, _WidgetBase, _WidgetsInTemplateMixin, CheckBox, RadioButton, array, declare, domConstruct, template) {
+    return declare([_WidgetBase,_TemplatedMixin,_WidgetsInTemplateMixin,_Container],{
         templateString: template,
-        allowMultiple: false,
         startup: function() {
             if ( this._started ) { return; }
@@ -17,10 +19,10 @@
             domConstruct.empty(this.domNode);
             var Ctor = this.allowMultiple === true ? CheckBox : RadioButton;
-            array.forEach(this.items, function(item, index){
+            array.forEach(this.items, function(item){
                 var div = domConstruct.create("div", {
                 }, this.domNode, "last");
                 var input = new Ctor({
-                    name: this.allowMultiple === true ? index.toString() : 'choice',
-                    value: item.text
+                    name: this.code + (this.allowMultiple === true ? item.subcode : ''),
+                    value: this.allowMultiple === true ? null : item.subcode
                 }).placeAt(div);
                 var label = domConstruct.create("label",{
@@ -29,20 +31,4 @@
                 }, div);
             }, this);
-        },
-        _getValueAttr: function() {
-            var value = this.inherited(arguments);
-            /*if ( this.allowMultiple === true ) {
-                return value;
-            } else {
-                return value.choice; //.length > 0;
-            }*/
-        },
-        _setValueAttr: function(value) {
-            var inherited = this.getInherited(arguments);
-            if ( this.allowMultiple === true ) {
-                inherited.call(this,value);
-            } else {
-                inherited.call(this,{choice:value ? ["on"] : []});
-            }
         }
     });
Index: Dev/trunk/src/client/qed-client/model/widgets/questions/NumberInputWidget.js
===================================================================
--- Dev/trunk/src/client/qed-client/model/widgets/questions/NumberInputWidget.js	(revision 506)
+++ Dev/trunk/src/client/qed-client/model/widgets/questions/NumberInputWidget.js	(revision 508)
@@ -1,29 +1,28 @@
 define([
-    "../../../widgets/_ComplexValueWidget",
+    "dijit/_Container",
+    "dijit/_TemplatedMixin",
+    "dijit/_WidgetBase",
+    "dijit/_WidgetsInTemplateMixin",
     "dojo/_base/declare",
     "dojo/text!./templates/NumberInputWidget.html"
-], function(_ComplexValueWidget, declare, template) {
-    return declare([_ComplexValueWidget],{
+], function(_Container, _TemplatedMixin, _WidgetBase, _WidgetsInTemplateMixin, declare, template) {
+    return declare([_WidgetBase,_TemplatedMixin,_WidgetsInTemplateMixin,_Container],{
+        templateString: template,
         text: '',
-        maxLength: null,
-        templateString: template,
         startup: function() {
+            if ( this._started ) { return; }
+            this.inherited(arguments);
+
             var constraints = {};
-            if ( this.min !== null && !isNaN(this.min) ) {
+            if ( this.min && !isNaN(this.min) ) {
                 constraints.min = this.min;
             }
-            if ( this.max !== null && !isNaN(this.max) ) {
+            if ( this.max && !isNaN(this.max) ) {
                 constraints.max = this.max;
             }
-            if ( this.places !== null && !isNaN(this.places) ) {
+            if ( this.places && !isNaN(this.places) ) {
                 constraints.places = this.places;
             }
             this.numberBox.set('constraints', constraints);
-        },
-        _getValueAttr: function() {
-            return this.numberBox.get('value');
-        },
-        _setValueAttr: function(value) {
-            return this.numberBox.set('value', value);
         }
     });
Index: Dev/trunk/src/client/qed-client/model/widgets/questions/ScaleInputWidget.js
===================================================================
--- Dev/trunk/src/client/qed-client/model/widgets/questions/ScaleInputWidget.js	(revision 506)
+++ Dev/trunk/src/client/qed-client/model/widgets/questions/ScaleInputWidget.js	(revision 508)
@@ -1,4 +1,7 @@
 define([
-    "../../../widgets/_ComplexValueWidget",
+    "dijit/_Container",
+    "dijit/_TemplatedMixin",
+    "dijit/_WidgetBase",
+    "dijit/_WidgetsInTemplateMixin",
     "dijit/form/RadioButton",
     "dojo/_base/array",
@@ -8,19 +11,8 @@
     "dojo/dom-construct",
     "dojo/text!./templates/ScaleInputWidget.html"
-], function(_ComplexValueWidget, RadioButton, array, declare, lang, domAttr, domConstruct, template) {
-    return declare([_ComplexValueWidget],{
+], function(_Container, _TemplatedMixin, _WidgetBase, _WidgetsInTemplateMixin, RadioButton, array, declare, lang, domAttr, domConstruct, template) {
+    return declare([_WidgetBase,_TemplatedMixin,_WidgetsInTemplateMixin,_Container],{
         templateString: template,
         baseClass: "qedScaleWidget",
-        min: 0,
-        max: 0,
-        minLabel: "",
-        maxLabel: "",
-        naLabel: null,
-        items: null,
-        value: null,
-        constuctor: function() {
-            this.items = [];
-            this.value = {};
-        },
         startup: function() {
             if ( this._started ) { return; }
@@ -42,5 +34,5 @@
         },
         _renderItems: function() {
-            array.forEach(this.items, function(item,index) {
+            array.forEach(this.items, function(item) {
                 var tr = domConstruct.create("tr", {}, this.itemsNode);
                 var td;
@@ -57,5 +49,5 @@
                     td = domConstruct.create("td", {}, tr);
                     radio = new RadioButton({
-                        name: index.toString(),
+                        name: this.code+item.subcode,
                         value: i.toString()
                     });
@@ -69,5 +61,5 @@
                     td = domConstruct.create("td", {}, tr);
                     radio = new RadioButton({
-                        name: index.toString(),
+                        name: this.code+item.subcode,
                         value: "n/a"
                     });
Index: Dev/trunk/src/client/qed-client/model/widgets/questions/StringInputWidget.js
===================================================================
--- Dev/trunk/src/client/qed-client/model/widgets/questions/StringInputWidget.js	(revision 506)
+++ Dev/trunk/src/client/qed-client/model/widgets/questions/StringInputWidget.js	(revision 508)
@@ -1,16 +1,13 @@
 define([
-    "../../../widgets/_ComplexValueWidget",
+    "dijit/_Container",
+    "dijit/_TemplatedMixin",
+    "dijit/_WidgetBase",
+    "dijit/_WidgetsInTemplateMixin",
     "dojo/_base/declare",
     "dojo/text!./templates/StringInputWidget.html"
-], function(_ComplexValueWidget, declare, template) {
-    return declare([_ComplexValueWidget],{
-        text: '',
+], function(_Container, _TemplatedMixin, _WidgetBase, _WidgetsInTemplateMixin, declare, template) {
+    return declare([_WidgetBase,_TemplatedMixin,_WidgetsInTemplateMixin,_Container],{
         templateString: template,
-        _getValueAttr: function() {
-            return this.textBox.get('value');
-        },
-        _setValueAttr: function(value) {
-            return this.textBox.set('value', value);
-        }
+        text: ''
     });
 });
Index: Dev/trunk/src/client/qed-client/model/widgets/questions/TextInputWidget.js
===================================================================
--- Dev/trunk/src/client/qed-client/model/widgets/questions/TextInputWidget.js	(revision 506)
+++ Dev/trunk/src/client/qed-client/model/widgets/questions/TextInputWidget.js	(revision 508)
@@ -1,21 +1,20 @@
 define([
-    "../../../widgets/_ComplexValueWidget",
+    "dijit/_Container",
+    "dijit/_TemplatedMixin",
+    "dijit/_WidgetBase",
+    "dijit/_WidgetsInTemplateMixin",
     "dojo/_base/declare",
     "dojo/text!./templates/TextInputWidget.html"
-], function(_ComplexValueWidget, declare, template) {
-    return declare([_ComplexValueWidget],{
+], function(_Container, _TemplatedMixin, _WidgetBase, _WidgetsInTemplateMixin, declare, template) {
+    return declare([_WidgetBase,_TemplatedMixin,_WidgetsInTemplateMixin,_Container],{
+        templateString: template,
         text: '',
-        maxLength: null,
-        templateString: template,
         startup: function() {
+            if ( this._started ) { return; }
+            this.inherited(arguments);
+
             if ( this.maxLength ) {
                 this.textArea.set('maxLength', this.maxLength);
             }
-        },
-        _getValueAttr: function() {
-            return this.textArea.get('value');
-        },
-        _setValueAttr: function(value) {
-            return this.textArea.set('value', value);
         }
     });
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 506)
+++ Dev/trunk/src/client/qed-client/model/widgets/questions/templates/MultipleChoiceInputWidget.html	(revision 508)
@@ -1,2 +1,2 @@
-<form>
-</form>
+<div>
+</div>
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 506)
+++ Dev/trunk/src/client/qed-client/model/widgets/questions/templates/NumberInputWidget.html	(revision 508)
@@ -1,4 +1,7 @@
-<form>
+<div>
   <p>${text}</p>
-  <div class="qedField" data-dojo-attach-point="numberBox" data-dojo-type="dijit/form/NumberTextBox" name="text"></div>
-</form>
+  <div class="qedField"
+       data-dojo-attach-point="numberBox"
+       data-dojo-type="dijit/form/NumberTextBox"
+       name="${code}${subcode}"></div>
+</div>
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 506)
+++ Dev/trunk/src/client/qed-client/model/widgets/questions/templates/ScaleInputWidget.html	(revision 508)
@@ -1,3 +1,3 @@
-<form class="${baseClass}">
+<div class="${baseClass}">
   <table>
     <thead>
@@ -12,3 +12,3 @@
     </tbody>
   </table>
-</form>
+</div>
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 506)
+++ Dev/trunk/src/client/qed-client/model/widgets/questions/templates/StringInputWidget.html	(revision 508)
@@ -1,4 +1,5 @@
-<form>
+<div>
   <p>${text}</p>
-  <div data-dojo-attach-point="textBox" data-dojo-type="dijit/form/TextBox" name="text"></div>
-</form>
+  <div data-dojo-type="dijit/form/TextBox"
+       name="${code}${subcode}"></div>
+</div>
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 506)
+++ Dev/trunk/src/client/qed-client/model/widgets/questions/templates/TextInputWidget.html	(revision 508)
@@ -1,4 +1,7 @@
-<form>
+<div>
   <p>${text}</p>
-  <textarea class="qedField" data-dojo-attach-point="textArea" data-dojo-type="dijit/form/Textarea" name="text"></textarea>
-</form>
+  <textarea class="qedField"
+            data-dojo-attach-point="textArea"
+            data-dojo-type="dijit/form/Textarea"
+            name="${code}${subcode}"></textarea>
+</div>
Index: Dev/trunk/src/client/qed-client/model/widgets/templates/SurveyRunWidget.html
===================================================================
--- Dev/trunk/src/client/qed-client/model/widgets/templates/SurveyRunWidget.html	(revision 506)
+++ Dev/trunk/src/client/qed-client/model/widgets/templates/SurveyRunWidget.html	(revision 508)
@@ -1,3 +1,10 @@
 <form class="${baseClass}">
+
+    <div>
+        <label for="mode" class="qedLabel">Title</label>
+        <textarea name="title" class="qedField"
+                  data-dojo-props="required: true"
+                  data-dojo-type="dijit/form/ValidationTextBox"></textarea>
+    </div>
 
     <div>
Index: Dev/trunk/src/client/qed-client/pages/response.js
===================================================================
--- Dev/trunk/src/client/qed-client/pages/response.js	(revision 506)
+++ Dev/trunk/src/client/qed-client/pages/response.js	(revision 508)
@@ -42,5 +42,5 @@
             var canDelete = (this.response &&
                              this.response._surveyRun.respondentCanDeleteOwnResponse);
-            this.cancelButton.set('disabled',canDelete||false);
+            this.cancelButton.set('disabled',canDelete?false:true);
             this.surveyWidget.set('readOnly', false);
         },
Index: Dev/trunk/src/client/qed-client/pages/surveys.js
===================================================================
--- Dev/trunk/src/client/qed-client/pages/surveys.js	(revision 506)
+++ Dev/trunk/src/client/qed-client/pages/surveys.js	(revision 508)
@@ -49,4 +49,5 @@
         _onRunSurvey:function(survey){
             var surveyRun = surveyRuns.create();
+            surveyRun.title = 'Run of "' + survey.title + '" of '+(new Date().toString());
             surveyRun.survey = survey;
             surveyRuns.save(surveyRun)
