N
Nicolas Van Lancker
Hi folks;
I have this webpage, allowing users to insert multiple records in one post
into the database.
Because I don't know the exact number of records they want to add, I created
a little javascript
that adds a new line with HTML inputboxes and lists to the form if they
press a button.
My first version of the script used innerHTML to add the new line of HTML
It works great in IE. But in NS/Mozilla each time I add new items the
already existing textboxes
(filled in) and already existing listboxes (with selected items) 'loose'
their data or selections.
var newhtmltoadd = '<input type=....' // The new line of html to add.
document.newline.innerHTML = document.newline.innerHTML + newhtmltoadd;
So I figured out this innerHTML way might not be the most fancy solution to
my problem and
I tried by the using the more DOM approach : appendChild
But the problem remains the same. Works fine in IE, NS/Mozilla reinitialise
my exisiting form objects in the area where I append.
Here is my appendChild code
var listbox=document.createElement('select');
listbox.setAttribute("name","FkRelie-New-"+id);
listbox.setAttribute("class","defaultlistbox");
//fill listbox with data from similar existing listbox
for(var
i=0;i<document.getElementById('FkRelie-New-1').length;i++) {
listbox.options=new
Option(document.getElementById("FkRelie-New-1").options.text);
listbox.options.value=new
Option(document.getElementById("FkRelie-New-1").options.value);
}
document.getElementById('NewPtLeft').appendChild(listbox);
Now. Is this a NS/Mozilla problem or am I doing something wrong?
How can I preserve state from my already exising form objects when adding
new ones in NS/Mozilla?
Thanx in advance,
Nicolas
I have this webpage, allowing users to insert multiple records in one post
into the database.
Because I don't know the exact number of records they want to add, I created
a little javascript
that adds a new line with HTML inputboxes and lists to the form if they
press a button.
My first version of the script used innerHTML to add the new line of HTML
It works great in IE. But in NS/Mozilla each time I add new items the
already existing textboxes
(filled in) and already existing listboxes (with selected items) 'loose'
their data or selections.
var newhtmltoadd = '<input type=....' // The new line of html to add.
document.newline.innerHTML = document.newline.innerHTML + newhtmltoadd;
So I figured out this innerHTML way might not be the most fancy solution to
my problem and
I tried by the using the more DOM approach : appendChild
But the problem remains the same. Works fine in IE, NS/Mozilla reinitialise
my exisiting form objects in the area where I append.
Here is my appendChild code
var listbox=document.createElement('select');
listbox.setAttribute("name","FkRelie-New-"+id);
listbox.setAttribute("class","defaultlistbox");
//fill listbox with data from similar existing listbox
for(var
i=0;i<document.getElementById('FkRelie-New-1').length;i++) {
listbox.options=new
Option(document.getElementById("FkRelie-New-1").options.text);
listbox.options.value=new
Option(document.getElementById("FkRelie-New-1").options.value);
}
document.getElementById('NewPtLeft').appendChild(listbox);
Now. Is this a NS/Mozilla problem or am I doing something wrong?
How can I preserve state from my already exising form objects when adding
new ones in NS/Mozilla?
Thanx in advance,
Nicolas