diff options
author | Andrew Dolgov <[email protected]> | 2013-03-18 10:26:24 +0400 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2013-03-18 10:26:26 +0400 |
commit | f0cfe83e3725f9a3928da97a6e3085e79cb25309 (patch) | |
tree | 4b0af188defaa807c7bc6ff3a101b41c9166c463 /lib/dijit/form/MappedTextBox.js.uncompressed.js | |
parent | 9a2885da170ffd64358b99194095851a2d09c1b6 (diff) |
upgrade dojo to 1.8.3 (refs #570)
Diffstat (limited to 'lib/dijit/form/MappedTextBox.js.uncompressed.js')
-rw-r--r-- | lib/dijit/form/MappedTextBox.js.uncompressed.js | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/lib/dijit/form/MappedTextBox.js.uncompressed.js b/lib/dijit/form/MappedTextBox.js.uncompressed.js new file mode 100644 index 000000000..1f9ed7509 --- /dev/null +++ b/lib/dijit/form/MappedTextBox.js.uncompressed.js @@ -0,0 +1,81 @@ +define("dijit/form/MappedTextBox", [ + "dojo/_base/declare", // declare + "dojo/dom-construct", // domConstruct.place + "./ValidationTextBox" +], function(declare, domConstruct, ValidationTextBox){ + + // module: + // dijit/form/MappedTextBox + + return declare("dijit.form.MappedTextBox", ValidationTextBox, { + // summary: + // A dijit/form/ValidationTextBox subclass which provides a base class for widgets that have + // a visible formatted display value, and a serializable + // value in a hidden input field which is actually sent to the server. + // description: + // The visible display may + // be locale-dependent and interactive. The value sent to the server is stored in a hidden + // input field which uses the `name` attribute declared by the original widget. That value sent + // to the server is defined by the dijit/form/MappedTextBox.serialize() method and is typically + // locale-neutral. + // tags: + // protected + + postMixInProperties: function(){ + this.inherited(arguments); + + // we want the name attribute to go to the hidden <input>, not the displayed <input>, + // so override _FormWidget.postMixInProperties() setting of nameAttrSetting + this.nameAttrSetting = ""; + }, + + // Override default behavior to assign name to focusNode + _setNameAttr: null, + + serialize: function(val /*=====, options =====*/){ + // summary: + // Overridable function used to convert the get('value') result to a canonical + // (non-localized) string. For example, will print dates in ISO format, and + // numbers the same way as they are represented in javascript. + // val: anything + // options: Object? + // tags: + // protected extension + return val.toString ? val.toString() : ""; // String + }, + + toString: function(){ + // summary: + // Returns widget as a printable string using the widget's value + // tags: + // protected + var val = this.filter(this.get('value')); // call filter in case value is nonstring and filter has been customized + return val != null ? (typeof val == "string" ? val : this.serialize(val, this.constraints)) : ""; // String + }, + + validate: function(){ + // Overrides `dijit/form/TextBox.validate` + this.valueNode.value = this.toString(); + return this.inherited(arguments); + }, + + buildRendering: function(){ + // Overrides `dijit/_TemplatedMixin/buildRendering` + + this.inherited(arguments); + + // Create a hidden <input> node with the serialized value used for submit + // (as opposed to the displayed value). + // Passing in name as markup rather than calling domConstruct.create() with an attrs argument + // to make query(input[name=...]) work on IE. (see #8660) + this.valueNode = domConstruct.place("<input type='hidden'" + (this.name ? ' name="' + this.name.replace(/"/g, """) + '"' : "") + "/>", this.textbox, "after"); + }, + + reset: function(){ + // Overrides `dijit/form/ValidationTextBox.reset` to + // reset the hidden textbox value to '' + this.valueNode.value = ''; + this.inherited(arguments); + } + }); +}); |