hwpok 发表于 2013-1-23 02:11:16

Ext 提交一个Form到Servlet

<div style="border-right: #cccccc 1px solid; padding-right: 5px; border-top: #cccccc 1px solid; padding-left: 4px; font-size: 13px; padding-bottom: 4px; border-left: #cccccc 1px solid; width: 98%; padding-top: 4px; border-bottom: #cccccc 1px solid; background-color: #eeeeee;">function myForm_1() {
    Ext.QuickTips.init();
    Ext.lib.Ajax.defaultPostHeader += '; charset=utf-8'
    var form = new Ext.FormPanel({
        frame : true,
        width : 300,
        monitorValid : true,// 绑定验证
        layout : "form",
        labelWidth : 70,
        title : "添加个人信息",
        labelAlign : "left",
        renderTo : Ext.getBody(),
        submit : function() {
            this.getEl().dom.action = '/ext/servlet/Login.do', this.getEl().dom.method = 'POST', this
                    .getEl().dom.submit();
        },
        items : [{
                    xtype : "textfield",
                    fieldLabel : "用户名",
                    id : "userName",
                    allowBlank : false,
                    blankText : "不能为空,请正确填写",
                    name : "userName",
                    anchor : "90%"
                }, {
                    xtype : "textfield",
                    fieldLabel : "昵称",
                    id : "smallName",
                    name : "smallName",
                    anchor : "90%"
                }, {
                    xtype : "datefield",
                    fieldLabel : "注册日期",
                    id : "regDate",
                    name : "regDate",
                    anchor : "90%"
                }],
        buttons : [{
                    text : "确定",
                    handler : function() {
                        form.form.submit();
                    },
                    formBind : true
                }, {
                    text : "取消",
                    handler : function() {
                        form.form.reset();
                    }
                }]
    });
}
Ext.onReady(myForm_1);
页: [1]
查看完整版本: Ext 提交一个Form到Servlet