PDA

View Full Version : use function return item error , need your help



21 Jan 2010, 11:56 PM
function fInput(label,name,allowblank,value){
return "{fieldLabel:'"+label+"',name:'"+name+"',allowBlank:"+allowblank+",value:'"+value+"'}"
}
insertItems = [{
xtype:'fieldset',
title: '1.userInfo',
collapsible: true,
autoHeight:true,
width:720,
defaults:{width:615},
defaultType: 'textfield',
items :[fInput('Username','userName',false,''),fInput('Name','realName',false,'')]
}];
function showInsert(){
var form = new Ext.form.FormPanel({
labelWidth: 75,
method:'POST',
bodyStyle:'padding:5px 5px 0',
plain:true,
autoScroll:true,
defaultType: 'textfield',
items:insertItems,
buttons: [{
text: 'Insert',
type:'button',
id:'Insert',
handler: function(){
if (form.form.isValid()){
form.getForm().submit({
waitMsg : '......',
url : '/DataInsert/exeInsert.asp',
method : 'post',
success : function(form, action) {
window.location.reload();
},
failure : function(form, action) {
Ext.Msg.alert('Error!','<b>'+action.result.msg+'</b>')
}
});
}
}},{
text: 'reset',
type:'reset',
id:'clear',
handler: function(){
form.form.reset();
}
}
]
});
var win = new Ext.Window({
title:'insert',
closable:true,
width:750,
height:550,
plain:true,
layout:'fit',
modal:true,
items:form
}).show();
}
showInsert()

didn't work... waiting for help