extJS如何通过按钮发布参数?
我有这个密码。若我点击按钮,我的表单参数将插入到数据库中。我怎么能做到呢??我应该在那里写什么? 如果我点击重置表单,我的窗口就会关闭。请帮忙!谢谢大家!extJS如何通过按钮发布参数?,extjs,Extjs,我有这个密码。若我点击按钮,我的表单参数将插入到数据库中。我怎么能做到呢??我应该在那里写什么? 如果我点击重置表单,我的窗口就会关闭。请帮忙!谢谢大家! var AddQuestion = new Ext.Button({ method : 'POST', url : '/questions/create', tooltip : 'Add Question', icon :
var AddQuestion = new Ext.Button({
method : 'POST',
url : '/questions/create',
tooltip : 'Add Question',
icon : '/images/icons/silk/add.png',
iconCls : 'add',
style : 'margin-right: 60px;float:right;',
handler : function() {
new Ext.Window({
title : 'Add Question',
width : 700,
height : 800,
bodyStyle : 'padding: 10px',
layout : 'form',
modal : true,
closable : true,
resizable : false,
draggable : false,
autowidth : true,
items :[
{
fieldLabel : 'Question',
name : 'question[text]',
xtype : 'htmleditor',
enableFont : false,
enableFormat : false,
enableFontSize : false,
enableLists : false,
enableAlignments: false,
enableFont : false,
enableColors : false,
height : 160,
width : 560
},
{
name :'form_type',
fieldLabel :'Form Type',
xtype :'combo',
triggerAction :'all',
mode :'local',
editable : false,
allowBlank : false,
emptyText :'You should Choose any...',
store :new Ext.data.SimpleStore({
fields :['mode', 'name'],
data :[
['1', 'TextArea Question'],
['2', 'Scale Question'],
['3', 'TextArea + Scale Question']
]
}),
displayField :'name',
valueField :'mode',
hiddenName :'form_type'
},
{
xtype : 'itemselector',
name : 'selected_respondents',
imagePath : '../ux/images/',
bodyStyle : 'background:#DFE8F6',
multiselects: [{
legend : 'All Respondents',
width : 270,
height : 350,
store : st,
displayField : 'email',
valueField : 'id',
hiddenName : 'email'
},{
legend : 'Selected Respondents',
width : 270,
height : 350,
store : st2,
displayField : 'email',
valueField : 'id',
hiddenName : 'email'
}]
},
{
fieldLabel :'To do',
xtype : 'button',
text : 'Refresh respondents ↑',
height : 30,
icon : '/images/icons/silk/arrow_refresh_small.png',
width : 180,
handler: function(){
if((who_is_admin == '1') || (who_is_admin == '0')){
if (st2.getCount() == 0){
st.reload();
}else
{
Ext.Msg.show({
title : 'Message for You',
msg : "You should left <i>'Selected Respondents'</i> field empty to <b>refresh</b> some changes!",
modal : true,
Height : 200,
closable : true,
resizable : false,
draggable : false,
Width : 300,
buttons : Ext.Msg.OK
});
}
}
}
},
{
xtype : 'checkbox',
boxLabel : 'Make Question Active',
inputValue : '1',
name : 'is_active',
hiddenName : 'is_active',
checked : true
},
],
buttons: [{
text: 'Reset Form',
handler: function(){
}
},{
text: 'Submit Form',
handler: function(){
}
}
}] // button end
}).show(); //show window
}
});
var AddQuestion=新建外部按钮({
方法:“POST”,
url:“/questions/create”,
工具提示:“添加问题”,
图标:'/images/icons/silk/add.png',
iconCls:“添加”,
样式:“右侧边距:60px;浮动:右侧;”,
处理程序:函数(){
新的分机窗口({
标题:“添加问题”,
宽度:700,
身高:800,
车身风格:“衬垫:10px”,
布局:“表单”,
莫代尔:是的,
closable:是的,
可调整大小:false,
可拖动:错误,
自动宽度:正确,
项目:[
{
fieldLabel:“问题”,
名称:“问题[文本]”,
xtype:'htmleditor',
enableFont:false,
enableFormat:false,
enableFontSize:false,
使能列表:false,
启用对齐:错误,
enableFont:false,
启用颜色:false,
身高:160,
宽度:560
},
{
名称:'form_type',
fieldLabel:“表单类型”,
xtype:“组合”,
触发操作:'all',
模式:'本地',
可编辑:false,
allowBlank:false,
emptyText:“您应该选择任何…”,
存储:新Ext.data.SimpleStore({
字段:['mode','name'],
数据:[
['1','文本区域问题'],
['2','比例问题'],
['3','TextArea+比例问题']
]
}),
显示字段:'name',
valueField:“模式”,
hiddenName:“表单类型”
},
{
xtype:'itemselector',
名称:“选定的受访者”,
imagePath:“../ux/images/”,
车身样式:“背景:#DFE8F6”,
多选:[{
图例:“所有受访者”,
宽度:270,
身高:350,
商店:圣,
displayField:'电子邮件',
valueField:'id',
hiddenName:“电子邮件”
},{
图例:“选定受访者”,
宽度:270,
身高:350,
商店:st2,,
displayField:'电子邮件',
valueField:'id',
hiddenName:“电子邮件”
}]
},
{
fieldLabel:“待办事项”,
xtype:'按钮',
文本:“刷新应答者&uarr;”,
身高:30,
图标:'/images/icons/silk/arrow_refresh_small.png',
宽度:180,
处理程序:函数(){
如果((谁是管理员='1')| |(谁是管理员='0')){
我
Ext.Ajax.request({
url:'assertion.htm', // url of page where you want to send it
method: 'POST',
params: {
selectedSource:source.getValue() //Right hand side whatever value you want to send
},
scope:this
});