]>
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 var ValidationTextBox = dijit.form.ValidationTextBox;
12 // dijit/form/MappedTextBox
14 // A dijit.form.ValidationTextBox subclass which provides a base class for widgets that have
15 // a visible formatted display value, and a serializable
16 // value in a hidden input field which is actually sent to the server.
18 return declare("dijit.form.MappedTextBox", ValidationTextBox
, {
20 // A dijit.form.ValidationTextBox subclass which provides a base class for widgets that have
21 // a visible formatted display value, and a serializable
22 // value in a hidden input field which is actually sent to the server.
24 // The visible display may
25 // be locale-dependent and interactive. The value sent to the server is stored in a hidden
26 // input field which uses the `name` attribute declared by the original widget. That value sent
27 // to the server is defined by the dijit.form.MappedTextBox.serialize method and is typically
32 postMixInProperties: function(){
33 this.inherited(arguments
);
35 // we want the name attribute to go to the hidden <input>, not the displayed <input>,
36 // so override _FormWidget.postMixInProperties() setting of nameAttrSetting
37 this.nameAttrSetting
= "";
40 // Override default behavior to assign name to focusNode
43 serialize: function(val
/*=====, options =====*/){
45 // Overridable function used to convert the get('value') result to a canonical
46 // (non-localized) string. For example, will print dates in ISO format, and
47 // numbers the same way as they are represented in javascript.
51 // protected extension
52 return val
.toString
? val
.toString() : ""; // String
57 // Returns widget as a printable string using the widget's value
60 var val
= this.filter(this.get('value')); // call filter in case value is nonstring and filter has been customized
61 return val
!= null ? (typeof val
== "string" ? val
: this.serialize(val
, this.constraints
)) : ""; // String
65 // Overrides `dijit.form.TextBox.validate`
66 this.valueNode
.value
= this.toString();
67 return this.inherited(arguments
);
70 buildRendering: function(){
71 // Overrides `dijit._TemplatedMixin.buildRendering`
73 this.inherited(arguments
);
75 // Create a hidden <input> node with the serialized value used for submit
76 // (as opposed to the displayed value).
77 // Passing in name as markup rather than calling domConstruct.create() with an attrs argument
78 // to make query(input[name=...]) work on IE. (see #8660)
79 this.valueNode
= domConstruct
.place("<input type='hidden'" + (this.name
? " name='" + this.name
.replace(/'/g, """) + "'" : "") + "/>", this.textbox, "after
");
83 // Overrides `dijit.form.ValidationTextBox.reset` to
84 // reset the hidden textbox value to ''
85 this.valueNode.value = '';
86 this.inherited(arguments);