2007-11-13
第四个范例——TextBox家族
首先声明,本人刚开始学习,英语不好,如果英语好的,推荐直接阅读英文资料。如果发现有不正确、不准确的地方,请纠正。
TextBox家族包括:Validation, Currency, Number, Date, Time等成员。这些widget都是基于html中Input类型为"text"的标签。
dijit.form.Textbox能实现去除空白字符、大小写处理、要求必须输入等功能。
dijit.form.ValidationTextbox扩展了dijit.form.Textbox,添加了校验功能。
dijit.form.NumberTextBox 、Date、Time扩展了dijit.form.ValidationTextbox,添加了国际化、格式化等功能。
常用快捷键:
属性(Attriburtes)
属性(Attriburtes)
方法(Methods)
属性(Attriburtes)
CurrencyTextBox和NumberTextBox的主要参数简介:
属性:
TextBox家族包括:Validation, Currency, Number, Date, Time等成员。这些widget都是基于html中Input类型为"text"的标签。
dijit.form.Textbox能实现去除空白字符、大小写处理、要求必须输入等功能。
dijit.form.ValidationTextbox扩展了dijit.form.Textbox,添加了校验功能。
dijit.form.NumberTextBox 、Date、Time扩展了dijit.form.ValidationTextbox,添加了国际化、格式化等功能。
常用快捷键:
- Tab
- Shift+Tab
- Enter
- Esc
属性(Attriburtes)
- lowercase: 如果为"true",转换所有英文字符为小写,默认为false。
- maxLength: 比html中的maxlength的兼容性更好,推荐使用。
- propercase: 如果为"true",单词首字母转为大写,默认为false。
- size: 和html标记类似,在TextBox不能使用。
- trim: 去除空白字符
- uppercase:如果为"true",转换所有英文字符为大写,默认为false。
- String getDisplayedValue()
- setDisplayedValue(/*String*/value)
- setValue(value, /*Boolean, optional*/ priorityChange, /*String, optional*/ formattedValue)
属性(Attriburtes)
- constraints: 定义约束规则,格式如Object{}
- invalidMessage:
- promptMessage:
- rangeMessage:
- regExp: 使用正则表达式进行校验,不能同时指定regExp和regExpGen,仅能用于ValidationTextBox,。
- required:
- displayMessage(/*String*/ message)
- String getErrorMessage(/* Boolean*/ isFocused)
- String getPromptMessage(/* Boolean*/ isFocused)
- Boolean isValid(/* Boolean*/ isFocused)
- regExpGen:仅在ValidationTextBox可用。用于生成正则表达式。
方法(Methods)
- compare
- isInRange
属性(Attriburtes)
- clickableIncrement:参考ISO-8601。
- value:参考ISO-8601。
- visibleIncrement:参考ISO-8601。
- visibleRange:参考ISO-8601。
CurrencyTextBox和NumberTextBox的主要参数简介:
属性:
- currency: 请参考ISO 4217规范,人民币为"CNY"。
- fractional: 如果为"true",使用pattern或places进行校验。
- locale:
- pattern: 请参考http://www.unicode.org/reports/tr35/#Number_Format_Patterns
- places: 指定数值位的长度。
- round: 如果为1,不四舍五入。
- strict: 词法解析,默认为"false"。
- symbol: 指定currency货币符号。
- type: 指定类型:decimal,percent,currency。decimal为默认值。
- DateTextBox和TimeTextBox的主要参数简介:
- am,pm: 指定am,pm表示法。
- datePattern,timePattern: 指定日期、时间格式,请参考http://www.unicode.org/reports/tr35/#Date_Format_Patterns。
- formatLength: 指定格式长度:long, short, medium or full 。默认为"short"。
- locale: 指定所属地区。
- selector: 指定类型:"time", "date"。默认为"date and time"。
- strict: 默认为"false",指定是否进行正则表达式校验。
发表评论
- 浏览: 56090 次

- 详细资料
搜索本博客
最近加入圈子
最新评论
-
对you must specify a loc ...
非常谢谢你啊!
-- by guoshiyu20 -
dojo 1.1 beta2发布了
dojo1.1 beta3发布了,下载地址:http://download.do ...
-- by noname365 -
对you must specify a loc ...
刚好遇到这个问题,使用你提到的办法解决了。谢谢!
-- by movingboy -
Dojo1.0简介
老兄你的文档终于出来了,多写一些例子:),3x
-- by karan -
dojo1.0.1正式发布了
速度问题是个折中 后台可以考虑,前台Web还是慎重
-- by airport






评论排行榜