我用ext里面包含了iframe 我怎么才能获得iframe里面的form对象呢?
当我点提交按钮的时候,就提交iframe里面的form表单adminLoginWin = new Ext.Window({
id:"adminLoginWin",
name:"adminLoginWin",
layout: 'fit',
title: '编辑餐馆信息',
// modal:true,
width:650,
height:450,
items: {
baseCls:"x-plane",
html: '<iframe id=operationInf width=100% height=100% src=restaurant_add.jsp>' },
buttons: [{
text:'提 交',
handler:doSubmit
},{
text: '重 置',
handler:function () {
Ext.MessageBox.confirm("提示","你确定要重置吗?", function (btn){
if (btn == "yes") {
adminLoginWin.getForm().reset();
}});
}
},{
text:'取 消',
handler: function(){
adminLoginWin.close();
}
}],
keys:[{key:Ext.EventObject.ENTER, fn:doSubmit, scope:this}]
});
adminLoginWin.show();
doSubmit的代码
iframe的form对象.submit({url:"/restaurant/restaurant_add.action",
waitTitle:"等待", method:"POST", waitMsg:"数据保存中...", success:function (form, action) {}
我现在想知道的是iframe的form对象如何写呢? 麻烦哪位大虾帮下忙,谢谢!
当我点提交按钮的时候,就提交iframe里面的form表单adminLoginWin = new Ext.Window({
id:"adminLoginWin",
name:"adminLoginWin",
layout: 'fit',
title: '编辑餐馆信息',
// modal:true,
width:650,
height:450,
items: {
baseCls:"x-plane",
html: '<iframe id=operationInf width=100% height=100% src=restaurant_add.jsp>' },
buttons: [{
text:'提 交',
handler:doSubmit
},{
text: '重 置',
handler:function () {
Ext.MessageBox.confirm("提示","你确定要重置吗?", function (btn){
if (btn == "yes") {
adminLoginWin.getForm().reset();
}});
}
},{
text:'取 消',
handler: function(){
adminLoginWin.close();
}
}],
keys:[{key:Ext.EventObject.ENTER, fn:doSubmit, scope:this}]
});
adminLoginWin.show();
doSubmit的代码
iframe的form对象.submit({url:"/restaurant/restaurant_add.action",
waitTitle:"等待", method:"POST", waitMsg:"数据保存中...", success:function (form, action) {}
我现在想知道的是iframe的form对象如何写呢? 麻烦哪位大虾帮下忙,谢谢!
你可以用js来完成的。
window.frames['operationInf'].document.formName
window.frames['operationInf'].document.getElementById("id")
所以直接使用Ext.get('operationInf').form得不到form
试试看Ext.get('operationInf').dom.form
未经测试,不清楚Ext.get('operationInf').dom是得到iframe对象还是iframe的容器,仅供参考