Need help with Firefox iframe, jsp, form submit issue

This is a discussion on "Need help with Firefox iframe, jsp, form submit issue" within the Other Programming Languages section. This forum, and the thread "Need help with Firefox iframe, jsp, form submit issue are both part of the Program Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > Other Programming Languages

Notices




Reply
 
LinkBack (1) Thread Tools
  1 links from elsewhere to this Post. Click to view. #1  
Old Feb 16th, 2006, 18:19
New Member
Join Date: Feb 2006
Age: 29
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Need help with Firefox iframe, jsp, form submit issue

OK well, heres our problem. We (my coworker and I) are trying to get our legacy code to be Firefox compatible. So in this code there is a js file we are including in the main page and on the login submit we call the following method
Code: Select all
var s= '<iframe src="/getEnvVariables.jsp" style="display:none"></iframe>';
document.body.insertAdjacentHTML("beforeEnd",s);
I got the insertAdjacentHTML method working and I also tried to make things work with the iframe directly on the main page.
Now the getEnvVariables page does load in firefox(both ways), but the form on that page won't submit in firefox unless we start the browser on getEnvVariables.jsp This is not an option though because the username and password entered are on the main page and are submitted from a form there, which getEnvironmentVariables collects in its form and then tries to submit. Here is the form code there:
Code: Select all
<form id="varForm" action="/setEnvVariables.jsp" method="post">
<input type="hidden" name="javaEnabled" value=""/>
......etc
</form>
and down below
Code: Select all
document.forms['varForm'].elements['javaEnabled'].value = javaEnabled;
..etc...
 
document.forms['varForm'].submit();
I've checked with alerts and the data is correctly being assigned in the form elements and it is getting past the submit statement without throwing any scripting error to Firefox's console. I'm wondering if anyone has seen anything like this or has suggestions. -bmachine

Last edited by Daniel; Mar 14th, 2007 at 19:20. Reason: [code] tags added for ease of reading
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Feb 26th, 2007, 16:30
New Member
Join Date: Feb 2007
Location: LocalHost
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Need help with Firefox iframe, jsp, form submit issue

The same problem, I've encountered: submitting a form into a dynamically created IFRAME: FireFox and Opera worked perfect but IE not! :mad: After 1 day of debugging, I founded that , following solution works:
Code: Select all
  var iFrameID  = 'ID1'; var myIFrame = document.createElement('iframe');  myIFrame.setAttribute('src', 'about:blank'); myIFrame.setAttribute('id', iFrameID); myIFrame.setAttribute('NAME', iFrameID); myIFrame.style.display = 'none'; document.body.appendChild(myIFrame); if(self.frames[iFrameID].name != iFrameID) { /* *** IMPORTANT: This is a BUG FIX for Internet Explorer *** */ self.frames[iFrameID].name = iFrameID; }
Meanning that AFTER the iframe is created, it should be checked that self.frames[iFrameID].name is equal with iFrameID No DIV, nothing else more! That's all! The problem was encountered and resolved by me during myAJAX development
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Feb 26th, 2007, 18:27
New Member
Join Date: Feb 2006
Age: 29
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Need help with Firefox iframe, jsp, form submit issue

Thanks a bunch, that is good to know for the future. Hopefully I can return the favor some day -bmachine
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Feb 26th, 2007, 21:41
New Member
Join Date: Feb 2007
Location: LocalHost
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Need help with Firefox iframe, jsp, form submit issue

You are welcome!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old Mar 14th, 2007, 19:01
New Member
Join Date: Feb 2007
Location: LocalHost
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Need help with Firefox iframe, jsp, form submit issue

PS:

After some more debugging (for my project) , I found another functional solution.
I'll paste here a part of the code
Code: Select all
  try 
        { /* IE specific */ 
         iFrame = document.createElement('<iframe id="' + newiFrameID + '" name="' + newiFrameID + '" src="about:blank" style="display: none; width: 0px; height: 0px; border: none;" myAJAXInnerHtmlId="' + InnerHtmlId + '"></iframe>');  
         if(iFrame.nodeName.toUpperCase() == 'IFRAME') { document.body.appendChild(iFrame); }
         else { throw new Error('`createElement` error.'); }
        }
     catch(e)
        {
         try
                { 
                 iFrame = document.createElement('iframe'); 
                 iFrame.setAttribute('src', 'about:blank');
                 iFrame.style.display = 'none';
                 iFrame.style.width   = '0px';
                 iFrame.style.height  = '0px';
                 iFrame.style.border  = 'none';
                 iFrame.setAttribute('id', newiFrameID);
                 iFrame.setAttribute('name', newiFrameID);
                 iFrame.setAttribute('myAJAXInnerHtmlId', InnerHtmlId);
                 document.body.appendChild(iFrame);
                 
                 if(self.frames.length == 0) 
                        { 
                         try { document.body.removeChild(iFrame); } catch(e) { }
                         throw new Error('`createElement` error.'); 
                        }
                }
}
The code is self-explanatory!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
help, firefox, iframe, jsp, form, submit, issue

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

LinkBacks (?)
LinkBack to this Thread: http://webforumz.com/other-programming-languages/5356-need-help-with-firefox-iframe-jsp.htm
Posted By For Type Date
document form submit This thread Refback Sep 28th, 2006 21:46

Similar Threads
Thread Thread Starter Forum Replies Last Post
form variable within an iframe component of a form kissfreaque PHP Forum 3 Feb 29th, 2008 13:06
form variable within an iframe component of a form kissfreaque JavaScript Forum 5 Feb 29th, 2008 11:57
submit() in iframe trouble ddprogrammer JavaScript Forum 3 Nov 5th, 2007 10:34
Firefox iframe problem Kropotkin Web Page Design 6 Oct 15th, 2007 20:30
submit many forms - auto submit the same form many times divs JavaScript Forum 0 May 24th, 2007 10:10


All times are GMT. The time now is 16:41.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42