zoukankan      html  css  js  c++  java
  • Extjs文本输入框

     var loginForm = Ext.create('Ext.form.Panel', {
            title: '单行输入',
            renderTo: Ext.getBody(),
            bodystyle: 'padding 5 5 5 5',
            200,
            height: 120,
            defaultType: 'textfield',//表单字段默认类型
            frame: true,
            defaults: {
                labelWidth: 50,
                150,
                labelSeparator: ':',
                labelAlign: 'left',
                allowBlank: false,
                blankText: "No blank",
                msgTarget: 'qtip'
            },
            items: [//selectOnFocus当表单项获得焦点时(在这里即是向输入框内输入用户名),获取表单项内所有内容。这样提取出了内容之后才有正则表达的‘材料’呀。
                { fieldLabel: '用户名', name: 'username', regex: /^([w]+)(.[w]+)*@([w-]+.){1,5}([a-zA-Z]){2,4}$/, regexText: '格式错误', selectOnFocus: true },
                { fieldLabel: '密码', name: 'password', inputType: 'password' }//name为表单项名称,标识表单,在使用setValues修改表单项字段
                 //input为字段类型,默认为text                                             //值时,用于向函数说明修改哪个表单
            ]                                                     //inputType  输入栏的类型属性---例如radio,checkbox,text,password,file,
            //                                                        默认是text
    ,
            buttons: [{
                
                text: "登陆",
                handler: function () { loginForm.getForm().setValues({ username: 'user@com', password: '123456' });alert(typeof login.getForm()) }
            }]//setValues用于批量表单项字段的值,参数为表单项名称:‘’的json对象或者是或者是数组[{id:'001',value:'user@com'}]
        });//getForm()用于表单面板获取对应的基本表单对象,即formPannel(Ext.form.pannel别名)只有调用了该函数才能对表单元素进行操作
  • 相关阅读:
    腾讯2016年实习生笔试题-蛇形数组-循环枚举遍历
    直接插入排序的加强版
    scanner 在java中的输入
    一种排序
    将string str中的str转换成字符数组
    呜呜呜
    ansible-playbook 实战案例 全网备份 实时备份
    Rsync服务实战
    TCP三次握手与四次握手
    centos 6.9修改系统默认字符集
  • 原文地址:https://www.cnblogs.com/lz3018/p/4579802.html
Copyright © 2011-2022 走看看