第四个范例——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,添加了国际化、格式化等功能。
常用快捷键:

Tab
Shift+Tab
Enter
Esc
dijit.form.TextBox的主要内容简介:
属性(Attriburtes)

lowercase: 如果为"true",转换所有英文字符为小写,默认为false。
maxLength: 比html中的maxlength的兼容性更好,推荐使用。
propercase: 如果为"true",单词首字母转为大写,默认为false。
size: 和html标记类似,在TextBox不能使用。
trim: 去除空白字符
uppercase:如果为"true",转换所有英文字符为大写,默认为false。
方法(Methods)

String getDisplayedValue()
setDisplayedValue(/*String*/value)
setValue(value, /*Boolean, optional*/ priorityChange, /*String, optional*/ formattedValue)
dijit.form.ValidationTextBox的主要内容简介:
属性(Attriburtes)

constraints: 定义约束规则,格式如Object{}
invalidMessage:
promptMessage:
rangeMessage:
regExp: 使用正则表达式进行校验,不能同时指定regExp和regExpGen,仅能用于ValidationTextBox,。
required:必须填写

方法(Methods)

displayMessage(/*String*/ message)
String getErrorMessage(/* Boolean*/ isFocused)
String getPromptMessage(/* Boolean*/ isFocused)
Boolean isValid(/* Boolean*/ isFocused)
regExpGen:仅在ValidationTextBox可用。用于生成正则表达式。
dijit.form.RangeTextBox的主要内容简介:
方法(Methods)

compare
isInRange
dijit.form.DateTextBox, dijit.form.TimeTextBox的主要内容简介:
属性(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",指定是否进行正则表达式校验。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值