Making a Delete button For a form Via JAVASCRIPT
Hello,
I am trying to create buttons for corresponding fields that when clicked will remove the fields and replace the fields with the fields below.

I have placed this javascript in a button under "run a javascript" when "mouse up"
var idNumber = event.target.name.replace("Delete", "");
for(var i = (parseInt(idNumber)); i <= 40; ++i) {
this.getField("ID"+(parseInt(idNumber)+(i)-1)).value = this.getField("ID"+(parseInt(idNumber)+(i))).value;
this.getField("Desc"+(parseInt(idNumber)+(i)-1)).value = this.getField("Desc"+(parseInt(idNumber)+(i))).value;
this.getField("No"+(parseInt(idNumber)+(i)-1)).value = this.getField("No"+(parseInt(idNumber)+(i))).value;
this.getField("Unit"+(parseInt(idNumber)+(i)-1)).value = this.getField("Unit"+(parseInt(idNumber)+(i))).value;
this.getField("Price"+(parseInt(idNumber)+(i)-1)).value = this.getField("Price"+(parseInt(idNumber)+(i))).value;
this.getField("Total"+(parseInt(idNumber)+(i)-1)).value = this.getField("Total"+(parseInt(idNumber)+(i))).value;
}
I have done some tests and it seems that the problem is with thee "i" variable
can someone please help me with this problem
Thank you all kindly in advance!
-Flynn
