Posts

Showing posts from March, 2005

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 drop