Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

Message Box Scripting

Avatar

Level 1

Hello,

I'm new to scripting and am hitting a wall. Hoping someone can point me in the right direction. I've created a form that has a plus button and minus button. If the user clicks the plus button, they'll add a row to their table. If they click the minus button, they will delete a row. I want to have a pop up appear when they attempt to delete a row that asks them if they are sure they want to delete it. I'm able to get the message box to appear, but I don't know how to control the actions of the answer they select. If they click "Yes" (they are sure they want to delete the row), I want the row to delete. If they click "No" (they don't want to delete the row), I want the user to just return to the form with no changes. I included my script for the minus button below. Can anyone help me with the rest? Thank you so much!

 

form1.GettingSettled.GettingSettled.Table1.Row1.Subform1.Remove::click - (JavaScript, client)

 

//JavaScript to add a row from a table

 

var

rowNum = this.parent.index + 1;

 

this.parent.parent.instanceManager.removeInstance(rowNum);

xfa.host.messageBox("Are you sure you want to delete this row?"

,"Deleting a Row",1,2);

1 Accepted Solution

Avatar

Correct answer by
Level 6

Try the below if block on the "click" event of "form1.GettingSettled.GettingSettled.Table1.Row1.Subform1.Remove" button.

if(xfa.host.messageBox("Are you sure you want to delete this row?","Deleting a Row",2,2) == "4"){

//In the above line: 4=Yes and 3=No

//Delete Row Code goes here

}

For more details please check the Adobe Help: http://help.adobe.com/en_US/livecycle/9.0/designerHelp/index.htm?content=001368.html

View solution in original post

2 Replies

Avatar

Correct answer by
Level 6

Try the below if block on the "click" event of "form1.GettingSettled.GettingSettled.Table1.Row1.Subform1.Remove" button.

if(xfa.host.messageBox("Are you sure you want to delete this row?","Deleting a Row",2,2) == "4"){

//In the above line: 4=Yes and 3=No

//Delete Row Code goes here

}

For more details please check the Adobe Help: http://help.adobe.com/en_US/livecycle/9.0/designerHelp/index.htm?content=001368.html

Avatar

Level 1

Thank you so much, Raghu Nagireddy! This worked perfectly. Truly appreciated!