source: Dev/trunk/client/qed/model/widgets/questions/NumberInputWidget.js @ 441

Last change on this file since 441 was 441, checked in by hendrikvanantwerpen, 12 years ago

Big cleanup of the question content.

  • Replaced old list implementations with a new one that behaves like a form widget.
  • All question content is now in separate widgets, not in the factory itself.
  • Added form and widget validation for question editing.
File size: 1015 bytes
Line 
1define([
2    "../../../widgets/_ComplexValueWidget",
3    "dojo/_base/declare",
4    "dojo/text!./templates/NumberInputWidget.html"
5], function(_ComplexValueWidget, declare, template) {
6    return declare([_ComplexValueWidget],{
7        text: '',
8        maxLength: null,
9        templateString: template,
10        startup: function() {
11            var constraints = {};
12            if ( this.min !== null && !isNaN(this.min) ) {
13                constraints.min = this.min;
14            }
15            if ( this.max !== null && !isNaN(this.max) ) {
16                constraints.max = this.max;
17            }
18            if ( this.places !== null && !isNaN(this.places) ) {
19                constraints.places = this.places;
20            }
21            this.numberBox.set('constraints', constraints);
22        },
23        _getValueAttr: function() {
24            return this.numberBox.get('value');
25        },
26        _setValueAttr: function(value) {
27            return this.numberBox.set('value', value);
28        }
29    });
30});
Note: See TracBrowser for help on using the repository browser.