Jump to content

Dynamic Add Row Script Dieing at 9 rows????


cmaclennan

Recommended Posts

Hey Guys,

 

I have a script that allows for additional rows to be added to a form i have if needed but i have just noticed that when i get upto and above 10 rows it stops working and just submits the first 9 rows again. Any help is greatly appreciated as i need to get this fixed as soon as humanly possible.

 

<script language="javascript">
		//add a row to the rows collection and get a reference to the newly added row
			var partsRowCount = 1; //stores the number of rows

		//add a new row to the table
		function addRow()
		{
			var namePrefix = "_" + (+partsRowCount + 1); //setup the prefix variable

			partsRowCount++; //increment the counter

			//add a row to the rows collection and get a reference to the newly added row
			var newRow = document.all("orderentry").insertRow();

			//add 3 cells (<td>) to the new row and set the innerHTML to contain text boxes

			var oCell = newRow.insertCell();
			oCell.innerHTML = "<input type='text' name='partid" + namePrefix + "'>";

			oCell = newRow.insertCell();
			oCell.innerHTML = "<input type='text' name='quantity" + namePrefix + "'>";

			oCell = newRow.insertCell();
			oCell.innerHTML = "<input type='text' name='desc" + namePrefix + "'>";

			oCell = newRow.insertCell();
			oCell.innerHTML = "<input type='text' name='serial" + namePrefix + "'>";			
		}

		//deletes the specified row from the table
		function removeRow(src)
		{
			/* src refers to the input button that was clicked.	
			   to get a reference to the containing <tr> element,
			   get the parent of the parent (in this case case <tr>)
			*/			
			var oRow = src.parentElement.parentElement;		

			//once the row reference is obtained, delete it passing in its rowIndex			
			document.all("orderentry").deleteRow(oRow.rowIndex);		
		}

	</script>

Link to comment
https://forums.phpfreaks.com/topic/167679-dynamic-add-row-script-dieing-at-9-rows/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.