Delete A Row

Suppose a table contains 15 rows and each row contains 4 fields named A1,B1,C1,D1 for the first row,A2,B2,C2,D2...

for the second row,A15,B15,C15,D15 and so on.Suppose you want to delete all the fields in a row by cliking any of the fields in the row.All the rows beneath the deleted one wil be moved up one,if the deleted row is fifth one,sixth row become fifth,seventh row become sixth and so on. Call a function "findline(name)"in the onFocus event of all the fields in all the rows. Call a function "deletei()" in the onclick event of action button.Then write the following code in the JSHeader event of the form.This works both in web and notes.Similarly you can make inserting a row. var lastdigit =0; function findline(fieldname) // Function Used to Find out the Field name for the currect cursor position// { var len; var ev; len=fieldname.length; lastdigit=fieldname.charAt(len-1); pre = fieldname.charAt(len-2); if (pre =="1") { lastdigit=pre+lastdigit; } lastdigit=eval(lastdigit); } //function for delete button // this function is used to delete a row from the requested item list// function deletei() { var incre; for(var i=lastdigit;i<15i++) { incre=i+1 document.forms[0]["A"+i].value=document.forms[0]["A"+incre].value; document.forms[0]["B"+i].value=document.forms[0]["B"+incre].value; document.forms[0]["C"+i].value=document.forms[0]["C"+incre].value; document.forms[0]["D"+i].value=document.forms[0]["D"+incre].value; } document.forms[0]["A"+15].value=""; document.forms[0]["B"+15].value=""; document.forms[0]["C"+15].value=""; document.forms[0]["D"+15].value=""; alert("One row of fields has been removed"); lastdigit =0 }

This was first published in November 2000

Dig Deeper



Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:




  • iSeries tutorials's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...