Hi Lilia,
> hi,
> I created a dynamic table employing selects, checkboxes, radio and text
> input.
> For each select, I have to call a function (to fill the second combo
> list), but when I "insert" more than 1 row (with selects, checkboxes,
> radio and text input respectively) I have problems.
> For example:
> I added three new rows (with selects, checkboxes, radio and text input).
> I selected in the first combo list one element and I called the function
> (to fill the second combo).
> I fill the second combo list but instead of fill the corresponding combo
> list (with the same index value), I filled the second combo list in the
> last row.
> How can I control the index for each row, when I add more than one row?
>
> my dynamic code to create the full row ( _NrowId is the index to identify
> each row):
I think the main problem is with this line...
> newinput0 = document.createElement("<SELECT class='data'
> onFocus='cargaListCC1(this.id)' onChange='cargaListIOs1
> (newinput2.id,this.options[this.selectedIndex].value); changeControl
> ();'>");
this results in an onchange for the first select of...
cargaListIOs1(newinput2.id,this.options[this.selectedIndex].value
newinput2 being local to the function that created the select boxes and out
of scope once inserted into the page.
One way to get this to work would be to change the newinput0 creation to
something like...
newinput0 = document.createElement("<SELECT class='data'
onFocus='cargaListCC1(this.id)' onChange='cargaListIOs1(\"" + newinput2.id +
"\",this.options[this.selectedIndex].value); changeControl();'>");
(ensure you create & set the id of newinput2 before this line)
HTH,
Chris