Ext.form.Layout布局--column布局

//Form Layout布局
Ext.onReady(function ()
{
    var panel = Ext.create("Ext.form.Panel", {
        width: 550,
        title: "【简单信息注册】FormLayout Panel",      
        bodyStyle:"padding:10px 10px 10px 10px",
        labelAlign: "center",
        id:"form",
        renderTo:Ext.getBody(),
        items: [{
            autoHeight: true,
            layout: "column",
            items: [{
                columnWidth:.50,
                xtype: "fieldset",
                title: "个人信息",
                layout: "form",
                style: "margin-left: 2px;padding-left:5px",
                fieldDefaults:{
                    labelWidth:70,
                    labelAlign:"left"
                },
                items: [
                    { fieldLabel: "姓  名", id:"userName", allowBlank: false,xtype:"textfield" },
                    { fieldLabel: "通信地址", id: "userAddress", allowBlank: false,xtype:"textfield" },
                    { fieldLabel: "Email", id: "userEmail", vtype: "email", allowBlank: false,xtype:"textfield" },
                    { fieldLabel: "年  龄", id: "userAge", xtype: "numberfield", maxValue: 100, minValue: 0, allowBlank: false }
                ]
            }, {
                columnWidth: .49,
                xtype: "fieldset",
                title:"企业信息",
                layout: "form",
                style: "margin-left: 5px;padding-left:5px",
                fieldDefaults: {
                    labelWidth: 70,
                    labelAlign: "left"
                },
            items: [
                { fieldLabel: "公司名称", id: "cmpName", allowBlank: false,xtype:"textfield" },
                { fieldLabel: "公司地址", id: "cmpAddress", allowBlank: false,xtype:"textfield" },
                { fieldLabel: "Email", id: "cmpEmail", vtype: "email", allowBlank: false,xtype:"textfield" },
                { fieldLabel: "注册时间", id: "cmpRegTime", xtype: "datefield", allowBlank: false,format:"Y-m-d" }
            ]
            }]
        }],
        buttons: [
            {
                text: "确定", handler: function ()
                {
                    var form = Ext.getCmp("form").getForm();
                    if (form.isValid())
                    {
                        var userName = Ext.getCmp("userName").getValue();
                        var userAddress = Ext.getCmp("userAddress").getValue();
                        var userEmail = Ext.getCmp("userEmail").getValue();
                        var userAge = Ext.getCmp("userAge").getValue();

                        var cmpName = Ext.getCmp("cmpName").getValue();
                        var cmpAddress = Ext.getCmp("cmpAddress").getValue();
                        var cmpEmail = Ext.getCmp("cmpEmail").getValue();
                        var cmpRegTime = Ext.getCmp("cmpRegTime").getValue();
                        
                        Ext.MessageBox.alert("提示", "个人注册信息为:<br/>" + userName + ",<br/>" + userAddress + ",<br/>" + userEmail + ",<br/>" + userAge + "<br/>企业注册信息为:<br/>" +
                            cmpName + ",<br/>" + cmpAddress + ",<br/>" + cmpEmail + ",<br/>" + cmpRegTime);
                    }
                }
            },
            {
                text: "取消", handler: function ()
                {
                    Ext.getCmp("form").getForm().reset();
                }
            }
        ]
    });
});

界面效果如下:

非空验证

Email格式验证

点击按钮后


  • 9
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值