Advertisement

09.18.2008 at 07:48AM PDT, ID: 23742528 | Points: 125
[x]
Attachment Details

Dynamically add rows to table AND to form

Asked by Ewertronics in JavaScript, Operating Systems Development

Tags:

Hi all,
I try to dynamically add lines to an existing table to be sent to a DB (update the table in fact).
I'm able to add the lines, but when I send the page/form to the second page, which updates the DB, the added lines are not there, because they weren't added to the form, too.
On a first example I could help myself with a hidden table, but now I'm at a point where I have to append the lines to the existing table AND to the form.

Can I make an append to a form and table of the same object?
Here's the code: Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
function add_seances()
  {	
	initseance[1]=document.getElementsByName('DateFormation')[0].value;
	initseance[2]=document.getElementsByName('Matin_de')[0].value;
	initseance[3]=document.getElementsByName('Matin_a')[0].value;
	initseance[4]=document.getElementsByName('Apres_midi_de')[0].value;
	initseance[5]=document.getElementsByName('Apres_midi_a')[0].value;
	initseance[6]=document.getElementsByName('SeanceFormateurInterne')[0].value;
	var tbl1 = document.getElementById('table1');
	var lastRow = tbl1.rows.length;
	var row = tbl1.insertRow(lastRow);
	for (var i = 1; i <= 6 ; i++) {
		var textNode = document.createElement('input');
		var cellLeft = row.insertCell(i-1);
		textNode.name = 'seance' + seance_count;
		seance_count=seance_count+1;
		textNode.type = 'text';
		if (i==6) textNode.size = 30;
		else  textNode.size = 10;
		textNode.value = initseance[i];
		cellLeft.appendChild(textNode); <-- this appends the cell to the table, but not to the form
		}
 
  }
[+][-]09.18.2008 at 09:07AM PDT, ID: 22512487

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.18.2008 at 08:40PM PDT, ID: 22517802

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.18.2008 at 10:19PM PDT, ID: 22518222

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.20.2008 at 07:38PM PDT, ID: 22532970

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628