Subversion Repositories Applications.papyrus

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1318 alexandre_ 1
/*
2
	Copyright (c) 2004-2006, The Dojo Foundation
3
	All Rights Reserved.
4
 
5
	Licensed under the Academic Free License version 2.1 or above OR the
6
	modified BSD license. For more information on Dojo licensing, see:
7
 
8
		http://dojotoolkit.org/community/licensing.shtml
9
*/
10
 
11
dojo.provide("dojo.widget.Textbox");
12
dojo.require("dojo.widget.*");
13
dojo.require("dojo.widget.HtmlWidget");
14
dojo.require("dojo.widget.Manager");
15
dojo.require("dojo.widget.Parse");
16
dojo.require("dojo.xml.Parse");
17
dojo.require("dojo.lang.array");
18
dojo.require("dojo.lang.common");
19
dojo.require("dojo.i18n.common");
20
dojo.requireLocalization("dojo.widget", "validate", null, "fr,ja,zh-cn,ROOT");
21
dojo.widget.defineWidget("dojo.widget.Textbox", dojo.widget.HtmlWidget, {className:"", name:"", value:"", type:"", trim:false, uppercase:false, lowercase:false, ucFirst:false, digit:false, htmlfloat:"none", templateString:"<span style='float:${this.htmlfloat};'>\n\t<input dojoAttachPoint='textbox' dojoAttachEvent='onblur;onfocus'\n\t\tid='${this.widgetId}' name='${this.name}'\n\t\tclass='${this.className}' type='${this.type}' >\n</span>\n", textbox:null, fillInTemplate:function () {
22
	this.textbox.value = this.value;
23
}, filter:function () {
24
	if (this.trim) {
25
		this.textbox.value = this.textbox.value.replace(/(^\s*|\s*$)/g, "");
26
	}
27
	if (this.uppercase) {
28
		this.textbox.value = this.textbox.value.toUpperCase();
29
	}
30
	if (this.lowercase) {
31
		this.textbox.value = this.textbox.value.toLowerCase();
32
	}
33
	if (this.ucFirst) {
34
		this.textbox.value = this.textbox.value.replace(/\b\w+\b/g, function (word) {
35
			return word.substring(0, 1).toUpperCase() + word.substring(1).toLowerCase();
36
		});
37
	}
38
	if (this.digit) {
39
		this.textbox.value = this.textbox.value.replace(/\D/g, "");
40
	}
41
}, onfocus:function () {
42
}, onblur:function () {
43
	this.filter();
44
}, mixInProperties:function (localProperties, frag) {
45
	dojo.widget.Textbox.superclass.mixInProperties.apply(this, arguments);
46
	if (localProperties["class"]) {
47
		this.className = localProperties["class"];
48
	}
49
}});
50