extjs4.2 弹出注册用户界面实例

var form2;
         Ext.onReady(function () {
             var form = new Ext.form.FormPanel({
                 frame: true,
                 title: '表单标题',
                 style: 'margin:10px',
                 html: '<div style="padding:10px">表单内容</div>'
            });
            
             var win = new Ext.Window({
                title: '标题',
                 width: 555,
                 height: 444,
                html: '<div>内容</div>',
                 resizable: true,
                 modal: true,
                 closable: true,
                  maximizable: true,
                 minimizable: true,
                 
                 items:form,
                  buttons: [{
		            text: '注册',
		            handler: login
		        },{
		        	text:'重置',
		        }]
             });
             
             win.show();
        
	function login(){
	
	
	var txtaccount = new Ext.form.TextField({
      		itemId: 'account',
      		anchor:'100%',
      		allowBlank:false,
      		maxLength:10,
      		name:'username',
      		fieldLabel:'帐号',
      		blankText:'请输入帐号',
      		maxLengthText:'用户名不超过10字'
      	});
	
	var txtusername = new Ext.form.TextField({
      		itemId: 'name',
      		anchor:'100%',
      		allowBlank:false,
      		maxLength:10,
      		name:'username',
      		fieldLabel:'姓名',
      		blankText:'请输入帐号',
      		maxLengthText:'用户名不超过10字'
      	});
	var txtpassword = new Ext.form.TextField({
      		anchor:'100%',
      		itemId: 'password',
      		allowBlank:false,
      		maxLength:10,
      		inputType:'password',
      		name:'password',
      		fieldLabel:'密码',
      		blankText:'请输入密码',
      		maxLengthText:'密码不超过10字'
      	});
      	
      	var txtpassword2 = new Ext.form.TextField({
      		anchor:'100%',
      		itemId: 'password2',
      		allowBlank:false,
      		maxLength:10,
      		inputType:'password',
      		name:'password',
      		fieldLabel:'重复密码',
      		blankText:'请输入密码',
      		maxLengthText:'密码不超过10字'
      	});
	
	var txtphone = new Ext.form.NumberField({
<span style="white-space:pre">		</span>                 fieldLabel:'手机号码',
<span style="white-space:pre">		</span>                 itemId: 'phone',
<span style="white-space:pre">		</span>                 anchor:'100%',
<span style="white-space:pre">		</span>                 decimalPrecision: 1,
<span style="white-space:pre">		</span>                 allowBlank: false,
<span style="white-space:pre">		</span>                 blankText: '请输入号码',
<span style="white-space:pre">		</span>                 value:user.phone,
<span style="white-space:pre">		</span>                 hideTrigger: true,
<span style="white-space:pre">		</span>       <span style="white-space:pre">			</span> keyNavEnabled: false,
<span style="white-space:pre">		</span>      <span style="white-space:pre">			</span> mouseWheelEnabled: false
<span style="white-space:pre">		</span>             });
      	var datefield = new Ext.form.DateField({
      		     itemId: 'createTime',
                 fieldLabel: '创建日期',
                 format: 'Y-m-d',
                 editable: false,
                 allowBlank: false,
                 blankText: '请选择日期'
             });
    form2 = new Ext.FormPanel({
      bodyStyle: 'padding:5px 5px 0',
      layout: 'form',
      items: [
      txtaccount,
      txtusername,
      txtpassword,
      txtpassword2,
      txtphone,
      datefield
      ],
      buttonAlign: 'center',
      buttons: [
    {
      text: '保存',
      handler:aa
    }, {
      text: '关闭',
      handler:function(){
      win2.hide();}
    }
    ]
    });
    var win2 = Ext.create("Ext.window.Window", {
      title: "添加用户",
      draggable: false,
      height: 300,	
      width: 300,
      layout: "fit",
      modal: true,
      resizable: false,
      items: [form2],
      closable: true,
      closeAction:'hide'
    });
    win2.show();
  }
  
  });
  
  
 function aa(){
 form2.getForm();
 	alert(form2.getComponent('password2').getValue());//获得输入的值,随便举个例子
 }
 

效果:



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值