Netscape 7.0 : Dynamically built controls loses value when their html is appended with a new html string!!

Here is what I found today :

My requirement was to dynamically add text boxes in the form based on selection made from a drop down box.

Then the user gets to type in information on the text box and save it.

I planned to use div tag , and create input boxes dynamically into the div tag. This worked great :
Here is what I did :
I built a html string (sInsertHTML) with the code to create input box . This I appended to the divTag's innerHTML property.

divTag.innerHTML = divTag.innerHTML + sInsertHTML

This produced the desired result. i.e. I was able to create controls based on the selection from the drop down, recursively.

PROBLEM
While the above condition worked great it lost any values previously input in those boxes!!!

To walk you through on what I did :
I used the drop down to select a value and clicked the insert button.
The code to write input control inside the div tag creates the control.
I type some value in the newly created textbox.

I then use the selection dropdown and select another value and click the ‘create button’ to append a new control to the div tag.
the new control is created along with the previously created control.
But the problem is that , the previously created control has lost its value!!!!!
Netscape does not retain the values within the controls, it retains only the html part of the tag.

But, IE6.0 retained the values correctly!!!

Comments

Popular posts from this blog

Drupal - How to display webform node in a block?

Error when Installing SQL Server 2008 R2 Management Studio

Technical Team Lead Interview Questions