Ignore:
Timestamp:
03/12/14 02:23:11 (11 years ago)
Author:
hendrikvanantwerpen
Message:
  • Server handles the new flat response format correctly.
  • Client widgets and survey rendering creates a flat structure.
  • Fixed logic error in checking if questions in survey are published.
  • Restrict accepted properties in answers and reject empty strings as properties.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Dev/trunk/src/client/qed-client/model/widgets/questions/MultipleChoiceInputWidget.js

    r500 r508  
    11define([
    2     "../../../widgets/_ComplexValueWidget",
     2    "dijit/_Container",
     3    "dijit/_TemplatedMixin",
     4    "dijit/_WidgetBase",
     5    "dijit/_WidgetsInTemplateMixin",
    36    "dijit/form/CheckBox",
    47    "dijit/form/RadioButton",
     
    710    "dojo/dom-construct",
    811    "dojo/text!./templates/MultipleChoiceInputWidget.html"
    9 ], function(_ComplexValueWidget, CheckBox, RadioButton, array, declare, domConstruct, template) {
    10     return declare([_ComplexValueWidget],{
     12], function(_Container, _TemplatedMixin, _WidgetBase, _WidgetsInTemplateMixin, CheckBox, RadioButton, array, declare, domConstruct, template) {
     13    return declare([_WidgetBase,_TemplatedMixin,_WidgetsInTemplateMixin,_Container],{
    1114        templateString: template,
    12         allowMultiple: false,
    1315        startup: function() {
    1416            if ( this._started ) { return; }
     
    1719            domConstruct.empty(this.domNode);
    1820            var Ctor = this.allowMultiple === true ? CheckBox : RadioButton;
    19             array.forEach(this.items, function(item, index){
     21            array.forEach(this.items, function(item){
    2022                var div = domConstruct.create("div", {
    2123                }, this.domNode, "last");
    2224                var input = new Ctor({
    23                     name: this.allowMultiple === true ? index.toString() : 'choice',
    24                     value: item.text
     25                    name: this.code + (this.allowMultiple === true ? item.subcode : ''),
     26                    value: this.allowMultiple === true ? null : item.subcode
    2527                }).placeAt(div);
    2628                var label = domConstruct.create("label",{
     
    2931                }, div);
    3032            }, this);
    31         },
    32         _getValueAttr: function() {
    33             var value = this.inherited(arguments);
    34             /*if ( this.allowMultiple === true ) {
    35                 return value;
    36             } else {
    37                 return value.choice; //.length > 0;
    38             }*/
    39         },
    40         _setValueAttr: function(value) {
    41             var inherited = this.getInherited(arguments);
    42             if ( this.allowMultiple === true ) {
    43                 inherited.call(this,value);
    44             } else {
    45                 inherited.call(this,{choice:value ? ["on"] : []});
    46             }
    4733        }
    4834    });
Note: See TracChangeset for help on using the changeset viewer.