Ignore:
Timestamp:
06/10/13 01:07:16 (12 years ago)
Author:
hendrikvanantwerpen
Message:

Save answers, improved response page and question widgets.

  • Warn if _ComplexValueMixin is not pout on a form element, to prevent 'name' collisions. Changed all depending widgets to <form>'s.
  • Fixed names for question widgets to actually save answers.
  • Fixed and improved response page.
  • Fixed names in MultipleChoice? widget, which behaves different for radio and check.
File:
1 edited

Legend:

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

    r443 r461  
    1010    return declare([_ComplexValueWidget],{
    1111        templateString: template,
     12        allowMultiple: false,
    1213        startup: function() {
    1314            if ( this._started ) { return; }
     
    2021                }, this.domNode, "last");
    2122                var input = new Ctor({
    22                     name: index.toString()
     23                    name: this.allowMultiple === true ? index.toString() : 'choice',
     24                    value: item.text
    2325                }).placeAt(div);
    2426                var label = domConstruct.create("label",{
     27                    for: input.id,
    2528                    innerHTML: item.text
    2629                }, div);
    2730            }, 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;
     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});
     46            }
    2847        }
    2948    });
Note: See TracChangeset for help on using the changeset viewer.