【问题标题】:Enable mask in a textfiend with sencha touch 2 forms?使用 sencha touch 2 表单在 textfiend 中启用掩码?
【发布时间】:2012-04-26 13:28:41
【问题描述】:

是否可以在 ST2 中的文本字段上设置掩码?

{
    xtype: 'textfield',
    name: 'phonenumber',
    label: 'Your phone number',
    mask: '(999) 999-9999'
},

在 Ext 中工作,但不在 ST 中,我“认为”ST 是在 Ext 之上构建的

【问题讨论】:

  • 面具是什么意思?任何形式的验证?
  • 我的意思是,在 ext 中,空字段看起来像“(999) 999-999”,当用户填写该字段时,它会立即到位。不谈验证。

标签: sencha-touch sencha-touch-2


【解决方案1】:

Sencha Touch 中没有直接属性可以完成这项工作。

所以,你可能需要做这样的事情..

{
    xtype: 'textfield',
    name: 'phonenumber',
    label: 'Your phone number',
    placeHolder: '(999) 999-9999',
    listeners : {
      keyup : function( ) {
        // Code that checks the i/p value according to placeHolder goes here ...
      } 
    }
},

顺便说一句,Sencha Touch 论坛上有一个post

希望对你有所帮助!

【讨论】:

猜你喜欢
  • 1970-01-01
  • 2012-07-09
  • 1970-01-01
  • 1970-01-01
  • 2012-05-21
  • 1970-01-01
  • 1970-01-01
  • 2011-05-17
  • 1970-01-01
相关资源
最近更新 更多