hi all,

I want to make one application using javacript or may be it is in ajax.

Let me explain my problem:

I have one select box name person which have value 0,1,2,3,4,5 . Now i want that when user will select value 1 from select box then person 1 first name , last name input type box will appear only one time in a row.
and if we will select 2 from select box then two row will appear naming person1 and person2 like this :
if we will not select any value by default is 0.then it will not show any row regarding person.
for exa:-
if we will select 3 from select box , then three row will disappear like this
person1 firstname1 lastname1 class1 section1
person2 firstname2 lastname2 class2 section2
person2 firstname3 lastname3 class3 section3

Please help me to solve this problem . How it can be.

thanks
gagan

Hi gagan.

I am not sure, I can understand your request. Do you mean that the <select> (comBox) chooses how many rows does have the form with empty <input> text fields?
Or do you want to control with the <select> (comBox) how many rows of an existing table will be shown (plain text?) ?
Elsewhere I've showed the way, how to build a dynamic table, which has at each row a button for add/duplicate a current row, and another button for delete the current row. But for some reason the first row cannot be deleted, because it is something like a 'prototype'. The described table can hold any visible input field and comBoxes.

Any how you need to prepare
- one 'prototype' row (HTML coded or javascript: createElemnt(); appendChild() way)
- cloneNode() and insertRow()
- repeat in loop by onChange event of the comBox which gives the number of rows

Do not forget, that <tbody> element must be respected while creating the table with javascript code, but can be omitted in HTML.

Give a note, if other detailed help is needed.

Jan

This article has been dead for over six months. Start a new discussion instead.