0
我有下面的代碼:ExtJS的問題按鈕
Ext.BLANK_IMAGE_URL = './ext/resources/images/default/s.gif';
Ext.onReady(function(){
Ext.QuickTips.init();
var addQuestionForm = new Ext.form.FormPanel({
frame :true,
method : 'POST',
items: [
{
xtype :'htmleditor',
width : "99%",
height : 200,
fieldLabel :'Question',
name :'question[text]',
}],
buttonAlign: 'center',
buttons: [
{
text : 'Submit',
height : 30,
icon : '/images/icons/silk/accept.png',
scale : 'large',
width : 500,
handler : function(){
if(addQuestionForm.getForm().isValid()){
addQuestionForm.getForm().submit({
// url:'/answers/create',
// waitMsg: 'Please wait...',
success : function(form, action) {
Ext.MessageBox.alert('Success!', 'Good job!');
// surveyWindow.close();
var redirect = '/admin/private_zone';
window.location = redirect;
},
failure: function(form, action){
Ext.MessageBox.alert('Failure!', action.result.msg);
}
});
}
}
}, {
text:'Cancel',
handler: function(){
var redirect = '/admin/private_zone';
window.location = redirect;
}
}]
});
var addQuestionWindow = new Ext.Window({
title : 'Add Question',
layout : 'form',
id : 'id-form',
width : 800,
height : 800,
modal : true,
closable : false,
resizable : false,
draggable : false,
autowidth : true,
closeAction : 'hide',
bodyStyle : 'padding: 10px',
items : [addQuestionForm]
});
addQuestionWindow.show();
});
問題是:當我按下「添加」按鈕,首先沒有任何反應,其次我retur我的登錄頁面上,我應該寫登錄&密碼。 WTF?所以當我按下按鈕時,我認爲會話被破壞了?如何避免這種情況?不要理解。我的代碼在按鈕中可能有問題?
我的代碼中沒有看到「添加」按鈕,是否提交? – 2011-05-23 23:33:14
yeyeys!當然提交!! – 2011-05-24 06:43:21
** @ Johnny **:注意多行*逗號* 'question [text]','。 – Chau 2011-05-24 06:58:19