按钮的extJS问题
我有以下代码:按钮的extJS问题,extjs,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',
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();
});
问题是:当我按下“添加”按钮时,首先什么也没发生,然后我在我的登录页面上返回,在那里我应该写登录名和密码。世界跆拳道联盟?所以我想当我按下按钮时会话被破坏了?如何避免这种情况?大学教师;我不明白。我的按钮中的代码可能有问题?我希望您在提交中使用URL行运行代码,但不要发表评论,因为如果您不指定URL,提交将不起作用。我在您的代码中没有看到“添加”按钮。您是指提交吗?@Johnny:注意行中多余的逗号
name:'question[text]“,
。是的,谢谢你,但是用这个逗号,不用说也不难,但是我要分析一下,如果在Chrome的开发者工具中使用Fiddler或network monitor,看看有什么反应。或者只是在成功和失败处理程序中为form-submit()方法设置一个断点。