Avatar

Level 2

Hello,

I have a table that can add and remove rows dynamically. An alert needs to be added to the remove button which I have done.  The alert works but when you select OK on the alert the row is not removed.

Would this be the correct way to accomplish this task?

I am not a programmer and now wondering if my code edit is wrong or there is an alternate solution.

Thank you

Capture.PNG

This is the code I have for the remove button.

form1.FSE_1.Pre_EX.Buttons.Remove::click - (JavaScript, both)

var cMsg = "Continuing with the current action will remove all cell entries for this row";

cMsg += "\n\nDo you want to continue?";

var nRtn = app.alert(cMsg,1,1,"Question Alert Box");

if(nRtn == 4)

{if (Table1._Item.count > 1)

Table1._Item.removeInstance(Table1._Item.count - 1);

console.println("The Response Was Yes");

}

else if(nRtn == 3)

{ // No Response

  console.println("The Response Was No");

}

else  

{ //Unknown Response

  console.println("The Response Was somthing other than Yes/No: " + nRtn);

}

----------------------------------------------------------------------------------------------------------------------------

This is the code I have for the Remove button before adding the alert which worked.

form1.FSE_1.Day_1.Buttons.Remove::click - (JavaScript, both)

if (Table1._Item.count > 1)

  Table1._Item.removeInstance(Table1._Item.count - 1);