ExtJS常用表单操作

1.Demo.html

    <script type="text/javascript">
        var form1 = new Ext.form.FormPanel({
            width:450,
            frame: true,
            renderTo: Ext.getBody(),
            submit: function () {
                this.getEl().dom.action = "Result.aspx",
                this.getEl().dom.method = "POST",
                this.getEl().dom.submit()
            },
            title: "FormPanel",
            bodyStyle: "padding:5px",
            defaults: { width: 500, xtype: "textfield" },
            items: [{ 
                xtype: "fieldset",
                title: "个人信息",
                collapsible: true, 
                autoHeight: true,
                width: 330,
                defaults: { width: 150 },
                defaultType: "textfield",
                items: [
                { fieldLabel: "姓名", name: "name", id: "name" },
                { fieldLabel: "密码", name: "pass", id: "pass", inputType: "password" },
                { xtype: "panel", layout: "column", fieldLabel: "性别", 
                  isFormField: true,
                  items: [{
                      columnWidth: .5,
                      xtype: "radio",
                      boxLabel: "男",
                      name: "sex",
                      inputValue:"男"

                  }, { columnWidth: .5,
                      xtype: "radio",
                      boxLabel: "女",
                      name: "sex",
                        inputValue:"女"
                  }]},
                {xtype: "panel", layout: "column", fieldLabel: "爱好", isFormField: true,
                      items: [{
                          columnWidth: .5,
                          xtype: "checkbox",
                          boxLabel: "足球",
                          name: "hobbit",
                          inputValue: "足球"
                      }, { columnWidth: .5,
                          xtype: "checkbox",
                          boxLabel: "篮球",
                          name: "hobbit",
                          inputValue: "篮球"
                      }, { columnWidth: .5,
                          xtype: "checkbox",
                          boxLabel: "乒乓球",
                          name: "hobbit",
                          inputValue: "乒乓球"
                      }]
                  },
                  { xtype: "datefield", fieldLabel: "生日", anchor: "99%",name:"date" },
                  { xtype: "combo", name: "province", store: ["湖北省", "湖南省", "广东省"], fieldLabel: "省份:", emptyText: "请选择您所在省份" }

                  ]
            }],
            buttons: [{ text: "确定",formBind:true, handler: function () {
                form1.form.submit();//!!!
            }
        }, { text: "取消", handler: function () { form1.form.reset(); } }]
        });
    </script>

2.Result.aspx

protected void Page_Load(object sender, EventArgs e)
    {
        string name = Request.Form["name"];
        string pass = Request.Form["pass"];
        string sex = Request.Form["sex"];
        string hobbit = Request.Form["hobbit"];
        string date = Request.Form["date"];
        string province = Request.Form["province"];
        Response.Write("用户名:--->" + name + "<br/>");
        Response.Write("密码:--->" + pass + "<br/>");
        Response.Write("性别:--->" + sex + "<br/>");
        Response.Write("爱好:--->" + hobbit + "<br/>");
        Response.Write("日期:--->" + date + "<br/>");
        Response.Write("所在省份:--->" + province + "<br/>");
    }


3.执行效果


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值