日期:2014-05-16  浏览次数:20363 次

extjs.form的取值设置

Ext.onReady(function(){
? var textfield1 = new Ext.form.TextField({
?
? ??? name:"username",
? ??? allowBlank:false,
? ??? fieldLabel:"用户名"
? });
???
?? var f = new Ext.form.FormPanel({
??
?? ??? ?title:"欢迎登陆",
?? ??? ?width:300,
?? ??? ?height:130,
?? ??? ?bodyStyle:"padding:6px",
?? ??? ?labelAlign:"right",
?? ??? ?frame:true,
?? ??? ?renderTo:Ext.getBody(),
?? ??? ?items:[textfield1,{
?? ??? ?
?? ??? ???? name:"password",
?? ??? ???? xtype:"textfield",
?? ??? ???? //inputType:"password",
?? ??? ???? fieldLabel:"密? 码"
?? ??? ?}],
?? ??? ?buttons:[{
?? ??? ?
?? ??? ???? text:"login",
?? ??? ???? handler:function(){
?? ??? ???? ??? var userName = f.getForm().findField("username").getValue();
?? ??? ???? ??? f.getForm().findField("password").setValue(userName);
?? ??? ???? ??? alert(userName);
?? ??? ???? }
?? ??? ?}]
?? });
???
})

?

?

这个例子的说明的是怎么取items中的textfield中的值 然后设置到其他的地方去。