source: Dev/trunk/src/client/dijit/form/_FormWidget.js

Last change on this file was 483, checked in by hendrikvanantwerpen, 11 years ago

Added Dojo 1.9.3 release.

File size: 2.9 KB
Line 
1define([
2        "dojo/_base/declare", // declare
3        "dojo/sniff", // has("dijit-legacy-requires"), has("msapp")
4        "dojo/_base/kernel", // kernel.deprecated
5        "dojo/ready",
6        "../_Widget",
7        "../_CssStateMixin",
8        "../_TemplatedMixin",
9        "./_FormWidgetMixin"
10], function(declare, has, kernel, ready, _Widget, _CssStateMixin, _TemplatedMixin, _FormWidgetMixin){
11
12        // module:
13        //              dijit/form/_FormWidget
14
15        // Back compat w/1.6, remove for 2.0
16        if(has("dijit-legacy-requires")){
17                ready(0, function(){
18                        var requires = ["dijit/form/_FormValueWidget"];
19                        require(requires);      // use indirection so modules not rolled into a build
20                });
21        }
22
23        return declare("dijit.form._FormWidget", [_Widget, _TemplatedMixin, _CssStateMixin, _FormWidgetMixin], {
24                // summary:
25                //              Base class for widgets corresponding to native HTML elements such as `<checkbox>` or `<button>`,
26                //              which can be children of a `<form>` node or a `dijit/form/Form` widget.
27                //
28                // description:
29                //              Represents a single HTML element.
30                //              All these widgets should have these attributes just like native HTML input elements.
31                //              You can set them during widget construction or afterwards, via `dijit/_WidgetBase.set()`.
32                //
33                //              They also share some common methods.
34
35                setDisabled: function(/*Boolean*/ disabled){
36                        // summary:
37                        //              Deprecated.  Use set('disabled', ...) instead.
38                        kernel.deprecated("setDisabled(" + disabled + ") is deprecated. Use set('disabled'," + disabled + ") instead.", "", "2.0");
39                        this.set('disabled', disabled);
40                },
41
42                setValue: function(/*String*/ value){
43                        // summary:
44                        //              Deprecated.  Use set('value', ...) instead.
45                        kernel.deprecated("dijit.form._FormWidget:setValue(" + value + ") is deprecated.  Use set('value'," + value + ") instead.", "", "2.0");
46                        this.set('value', value);
47                },
48
49                getValue: function(){
50                        // summary:
51                        //              Deprecated.  Use get('value') instead.
52                        kernel.deprecated(this.declaredClass + "::getValue() is deprecated. Use get('value') instead.", "", "2.0");
53                        return this.get('value');
54                },
55
56                postMixInProperties: function(){
57                        // Setup name=foo string to be referenced from the template (but only if a name has been specified).
58                        // Unfortunately we can't use _setNameAttr to set the name in IE due to IE limitations, see #8484, #8660.
59                        // But when IE6 and IE7 are desupported, then we probably don't need this anymore, so should remove it in 2.0.
60                        // Also, don't do this for Windows 8 Store Apps because it causes a security exception (see #16452).
61                        // Regarding escaping, see heading "Attribute values" in
62                        // http://www.w3.org/TR/REC-html40/appendix/notes.html#h-B.3.2
63                        this.nameAttrSetting = (this.name && !has("msapp")) ? ('name="' + this.name.replace(/"/g, "&quot;") + '"') : '';
64                        this.inherited(arguments);
65                },
66
67                // Override automatic assigning type --> focusNode, it causes exception on IE.
68                // Instead, type must be specified as ${type} in the template, as part of the original DOM
69                _setTypeAttr: null
70        });
71});
Note: See TracBrowser for help on using the repository browser.