Promet Knowledge Sharing

Archive for the ‘Javascript’ Category

InnerHTML in Firefox

without comments

I ran once an error in InnerHTML when trying to display AJAX imported form fields and post the values entered for these fields. The values were being passed when the form is submitted in IE, but not in Firefox. Firefox only returns a javascript error stating that the field has no properties and thus returning an undefined value.

After much trials-and-error reconstructing the AJAX imported field and searching the net for a possible solution, I came upon this site (http://www.robertnyman.com/2006/04/20/we-all-love-innerhtml/) where the fix came from one of the readers’ comments.

You need to make the form, where the AJAX imported form fields are located, nested correctly. As for my case, it should follow the correct nesting layout between forms and table. So I changed this previous layout:

<table>
 <form> 
   …. Other elements here ..
 </form>
</table>

To this:

<form>
  <table>
   …. Other elements here ..
  </table>
</form>

And that did the trick, I was then able to submit values entered from the AJAX generated fields passed through innerHTML in Firefox.

Written by tere

August 21st, 2008 at 5:28 am

Posted in HTML, Javascript

Tagged with , , ,