HTML Form Target directed to IFRAM working in FF but not IE

泪湿孤枕 提交于 2019-12-24 23:15:03

问题


I have a form which consists of two different targets. One target submits the form and the other presents a preview of the form data. My only issue here is that my logic works fine in firefox however the iframe in which the preview is to be displayed remains blank when I click the preview button. I've also noticed the form data being listed in the parent URL(text fields,selections ,etc...) , which shouldn't happen since the target is pointing to the iframe and not the parent. I've changed my security settings in IE and have confirmed that iframes do function correctly under normal circumstances. Any suggestions on what I could be doing wrong?

The Form logic:

<form name="sourceConfigForm" onSubmit="return OnSubmitForm();return false;">
...
<INPUT TYPE="SUBMIT" name="Operation" onClick="document.pressed=this.value" VALUE="Submit">
<INPUT TYPE="SUBMIT" name="Operation" id="previewButton" "onClick="document.pressed=this.value" VALUE="Preview XML">
</form>

The IFRAME Declaration:

<IFRAME SRC="" NAME="previewFrame" id="previewFrame"  WIDTH="300px" HEIGHT="400px" FRAMEBORDER="0"></IFRAME>

The java script called on form submission:

 function OnSubmitForm()
 {
   if(document.pressed == 'Preview XML')
   { 

     document.sourceConfigForm.target='previewFrame';
      //action calls spring controller
     document.sourceConfigForm.action ="XMLPreview"; 
   }
   else
   if(document.pressed == 'Submit')
   {
     document.sourceConfigForm.target="";
      //action calls spring controller
     document.sourceConfigForm.action ="AddSourceConfig";
   }
 }

回答1:


Keep the Iframe within form tag, atleast this worked for me.



来源:https://stackoverflow.com/questions/3963202/html-form-target-directed-to-ifram-working-in-ff-but-not-ie

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!