473,386 Members | 1,738 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Problem with dynamically changing form in Firefox using innerHTML

I have a web page which has javascript which uses the innerHTML property of a <TD> object to replace that table cell's contents. The contents are of the form
Expand|Select|Wrap|Line Numbers
  1. <span><select><option1.../><option2..>...</select></span> 
(in engish, the <td> contains a <span> which contains a <select> which contains some number of <option>s.

It works fine in IE. In Firefox it displays fine but when I submit the form the name and value for the select tag are missing from the request that is sent to the server. Another symptom is that in Firefox the DOM object for select is missing from document.forms[0].elements[] array

The reason I am using innerHTML rather than using the DOM methods to manipulate the options in the select is that the list of options is computed by a JSP tag on the server-side (and accessed via Ajax).

Does anyone know if there is a way get Firefox to create the <select> properly when it is created by setting the innerHTML on a <td>?
Oct 5 '07 #1
5 2537
acoder
16,027 Expert Mod 8TB
Welcome to TSDN!

Can you show a real example of a select HTML snippet that is returned by the JSP?
Oct 5 '07 #2
pbmods
5,821 Expert 4TB
Heya, pjdeklerk.

Please use CODE tags when posting source code:

[CODE=html]
HTML code goes here.
[/CODE]
Oct 6 '07 #3
drhowarddrfine
7,435 Expert 4TB
I don't know if this would affect it but <span> is an inline element being wrapped around <select> which is block-level. Whether that confuses things in the tree at that point, I don't know.
Oct 6 '07 #4
pbmods
5,821 Expert 4TB
Heya, pjdeklerk.

What's the JavaScript look like that generates the options for the select element?
Oct 6 '07 #5
I had this exact same problem.

Possible solution:

Make sure your <form> tags are outside of your <table> tags. IE doesn't care, but Firefox gets mad when the form is rooted inside a table or td.

(sounds too simple to be true, but it worked for me!)

Good luck!
Oct 15 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: obsidian8 | last post by:
Hi All, I have looked around for an answer to this question, but haven't found one as of yet. I'm trying to use javascript to dynamically create raido buttons. I am able to create them easily...
9
by: Michelle | last post by:
I have a div that is initially empty. Clicking on a button will add some text boxes and other controls so the user can add additional records. In IE all works fine but in Netscape 7.0 when I add...
2
by: sveinn | last post by:
Hi all, I've read through this group searching for an answear about this problem. Few have come close but not quite what I need. My problem is this: I'm using Ajax to fetch a new table with...
26
by: shlomi.schwartz | last post by:
using this example: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Test Page</title> </head>
4
by: tcole6 | last post by:
My problem appears to be Firefox specific. I have a hyperlink that loads a new window. This window contains hyperlinks that call javascript functions in the parent window and then closes the...
11
by: Daz | last post by:
Hello everyone. I am sure the answer to my question is simple, but I can't seem to dynamically add an onClick event to my script. I have a table which is generated dynamically, I am just...
7
by: John | last post by:
Hi Everyone, I'm having this extremely annoying problem with Internet Explorer 6, giving me an error message saying "unknown runtime error" whenever I try to alter the contents of a <divelement...
3
by: Ralph | last post by:
Hi I have small function to generate my form controls: function buildInput(sType, vValue, vId, sName, sLabel){ var oInput = null; var oLabel = document.createElement('label'); var oCont =...
2
by: shivendravikramsingh | last post by:
hi friends, i m using a ajax function for retrieving some values from a database table,and display the values in required field,my prob is that the ajax function i m using is working f9 once,but if...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.