Ext学习_表单组件5

	//最高学历
	//准备数据
	var data = [
	    [1,"博士"],
	    [2,"硕士"],
	    [3,"研究生"],
	    [4,"本科"],
	    [5,"专科"],
	    [6,"高中"],
	    [7,"文盲"]
	];
	var proxy = new Ext.data.MemoryProxy(data);
	//定义学历结构
	var edu = new Ext.data.Record.create([
	     {name:"eid", type: "int", mapping: 0},
	     {name:"ename", type: "string", mapping: 1}
	]);
	var reader = new Ext.data.ArrayReader({},edu);
	var store = new Ext.data.Store({
		proxy: proxy,
		reader: reader
	});
	
	//加载数据
	store.load();
	var chkEdu = new Ext.form.ComboBox({
		name: "chkEdu",
		fieldLabel: "最高学历",
		store: store,
		mode: "local",
		triggerAction: "all",
		emptyText: "请选择最高学历",
		displayField: "ename",
		valueField:"eid",
		value: 3 //缺省值
	});
	
	var numLove = new Ext.form.NumberField({
		name: "numLove",
		fieldLabel: "最喜欢的数字"
	});
	
	var areaAddress = new Ext.form.TextArea({
		name: "areaAddress",
		fieldLabel: "家庭住址",
		width: 500,
		height: 50
	});
	
	var timeWork = new Ext.form.TimeField({
		name: "timeWork",
		fieldLabel: "上班时间",
		increment: 30,
		fommat: "H:i"
	});
	
/*	
 * json对象
 * var timeWork = {
			name: "timeWork",
			xtype: "timefield",
			fieldLabel: "上班时间"
	}*/
	
	//个人简介
	var htmlIntro = new Ext.form.HtmlEditor({
		name: "htmlIntro",
		fieldLabel: "个人简介",
//		enableLists: false,
//		enableSourceEdit: false,
		height: 150
	});
	
	var txtPhoto = new Ext.form.TextField({
		name: "txtPhoto",
		inputType: "file",
		fieldLabel: "照片",
		width: 500
	});
	
	var btnSubmit = new Ext.Button({
		text: "提交",
		handler: function(){
			f.getForm().submit({
				success: function(form, action){
					form.items.each(function(field){
						if(field.isFormField){
							alert(field.getName() + "=" + field.getValue());
						}
					});
				},
				
				failure: function(){
					Ext.MessageBox.alert("","表单提交失败!");
				}
			});
		}
	});
	
	var btnReset = new Ext.Button({
		text: "重置",
		handler: function(){
			f.getForm().reset();
		}
	});
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值