iEntry 10th Anniversary Webforumz RegistrationAnnouncements Contact Webforumz StaffContact
Home Resources Blogs Meet the Team Contact Register
 

Go Back   WebForumz.com > The Code > Other Languages

Reply
 
LinkBack (1) Thread Tools
Old February 16th, 2006, 02:19 PM   1 links from elsewhere to this Post. Click to view. #1
New Member
 

Join Date: Feb 2006
Age: 30
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 bmachine is on a distinguished road
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:
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:
<form id="varForm" action="/setEnvVariables.jsp" method="post">
<input type="hidden" name="javaEnabled" value=""/>
......etc
</form>
and down below
Code:
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; March 14th, 2007 at 04:20 PM.. Reason: [code] tags added for ease of reading
bmachine is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old February 26th, 2007, 12:30 PM   #2
New Member
 

Join Date: Feb 2007
Location: LocalHost
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 raul is on a distinguished road
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:
  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
raul is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old February 26th, 2007, 02:27 PM   #3
New Member
 

Join Date: Feb 2006
Age: 30
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 bmachine is on a distinguished road
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
bmachine is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old February 26th, 2007, 05:41 PM   #4
New Member
 

Join Date: Feb 2007
Location: LocalHost
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 raul is on a distinguished road
Re: Need help with Firefox iframe, jsp, form submit issue

You are welcome!
raul is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old March 14th, 2007, 04:01 PM   #5
New Member
 

Join Date: Feb 2007
Location: LocalHost
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 raul is on a distinguished road
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:
  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!
raul is offline  
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

Bookmarks

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


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

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
form variable within an iframe component of a form kissfreaque PHP 3 February 29th, 2008 09:06 AM
form variable within an iframe component of a form kissfreaque JavaScript 5 February 29th, 2008 07:57 AM
submit() in iframe trouble ddprogrammer JavaScript 3 November 5th, 2007 06:34 AM
Firefox iframe problem Kropotkin HTML, XHTML and CSS 6 October 15th, 2007 04:30 PM
submit many forms - auto submit the same form many times divs JavaScript 0 May 24th, 2007 06:10 AM


Search Engine Optimization by vBSEO 3.2.0 RC8