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别名)只有调用了该函数才能对表单元素进行操作
  • 相关阅读:
    javascript获得元素的尺寸和位置二 : clientWidth/Height、scrollWidth/Height、scrollTop/Left
    CSS中的Position属性
    JavaScript沙箱SandBox设计模式
    JavaScript中为事件句柄绑定监听函数
    MatrixTransform矩阵变换
    getBoundingClientRect计算页面元素的offsetLeft、offsetTop
    PHP Warning: date() [function.date]: It is not safe to rely on the system's timezone
    CollectGarbage函数JS清理垃圾,内存释放
    (转)python路径操作新标准:pathlib 模块
    (转)sql函数总结(更新中... ...)
  • 原文地址:https://www.cnblogs.com/lz3018/p/4579802.html
Copyright © 2011-2022 走看看