]>
git.wh0rd.org - tt-rss.git/blob - lib/dijit/form/MappedTextBox.js.uncompressed.js
1 define("dijit/form/MappedTextBox", [
2 "dojo/_base/declare", // declare
3 "dojo/dom-construct", // domConstruct.place
5 ], function(declare
, domConstruct
, ValidationTextBox
){
8 // dijit/form/MappedTextBox
10 return declare("dijit.form.MappedTextBox", ValidationTextBox
, {
12 // A dijit/form/ValidationTextBox subclass which provides a base class for widgets that have
13 // a visible formatted display value, and a serializable
14 // value in a hidden input field which is actually sent to the server.
16 // The visible display may
17 // be locale-dependent and interactive. The value sent to the server is stored in a hidden
18 // input field which uses the `name` attribute declared by the original widget. That value sent
19 // to the server is defined by the dijit/form/MappedTextBox.serialize() method and is typically
24 postMixInProperties: function(){
25 this.inherited(arguments
);
27 // we want the name attribute to go to the hidden <input>, not the displayed <input>,
28 // so override _FormWidget.postMixInProperties() setting of nameAttrSetting
29 this.nameAttrSetting
= "";
32 // Override default behavior to assign name to focusNode
35 serialize: function(val
/*=====, options =====*/){
37 // Overridable function used to convert the get('value') result to a canonical
38 // (non-localized) string. For example, will print dates in ISO format, and
39 // numbers the same way as they are represented in javascript.
43 // protected extension
44 return val
.toString
? val
.toString() : ""; // String
49 // Returns widget as a printable string using the widget's value
52 var val
= this.filter(this.get('value')); // call filter in case value is nonstring and filter has been customized
53 return val
!= null ? (typeof val
== "string" ? val
: this.serialize(val
, this.constraints
)) : ""; // String
57 // Overrides `dijit/form/TextBox.validate`
58 this.valueNode
.value
= this.toString();
59 return this.inherited(arguments
);
62 buildRendering: function(){
63 // Overrides `dijit/_TemplatedMixin/buildRendering`
65 this.inherited(arguments
);
67 // Create a hidden <input> node with the serialized value used for submit
68 // (as opposed to the displayed value).
69 // Passing in name as markup rather than calling domConstruct.create() with an attrs argument
70 // to make query(input[name=...]) work on IE. (see #8660)
71 this.valueNode
= domConstruct
.place("<input type='hidden'" + (this.name
? ' name="' + this.name
.replace(/"/g, """) + '"' : "") + "/>", this.textbox, "after
");
75 // Overrides `dijit/form/ValidationTextBox.reset` to
76 // reset the hidden textbox value to ''
77 this.valueNode.value = '';
78 this.inherited(arguments);