From 1354d17270961fff662d40f90521223f8fd0d73b Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Tue, 14 Aug 2012 18:59:10 +0400 Subject: update dojo to 1.7.3 --- lib/dijit/form/MappedTextBox.js.uncompressed.js | 89 +++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 lib/dijit/form/MappedTextBox.js.uncompressed.js (limited to 'lib/dijit/form/MappedTextBox.js.uncompressed.js') diff --git a/lib/dijit/form/MappedTextBox.js.uncompressed.js b/lib/dijit/form/MappedTextBox.js.uncompressed.js new file mode 100644 index 000000000..2f8f69d19 --- /dev/null +++ b/lib/dijit/form/MappedTextBox.js.uncompressed.js @@ -0,0 +1,89 @@ +define("dijit/form/MappedTextBox", [ + "dojo/_base/declare", // declare + "dojo/dom-construct", // domConstruct.place + "./ValidationTextBox" +], function(declare, domConstruct, ValidationTextBox){ + +/*===== + var ValidationTextBox = dijit.form.ValidationTextBox; +=====*/ + + // module: + // dijit/form/MappedTextBox + // 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. + + 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 , not the displayed , + // 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 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("", this.textbox, "after"); + }, + + reset: function(){ + // Overrides `dijit.form.ValidationTextBox.reset` to + // reset the hidden textbox value to '' + this.valueNode.value = ''; + this.inherited(arguments); + } + }); +}); -- cgit v1.2.3