Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Hide table row delete button

Avatar

Level 9

I have a table with row 1 visible and row 2 that appears when the "Add a New Row" button is clicked. If the user clicks the "Delete Last Row" button, the last row is deleted. I want the "Delete Last Row" button  to only be visible when there is more than one row visible.

This script does not work:

 

if (Page1.Subform2.Table1._Row2.count =< 1){

this.presence = "visible";

}

else {

this.presence = "invisible"; 

}

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

Is this a code fragment from the click event of the "Delete Last Row" button?, I think you just need to swap the "=<" to "<=", this should have given you a syntax error, or is this just from getting the code into the forum?,

Anyway, try this in the delete button click event;

Page1.Subform2.Table1._Row2.removeInstance(Page1.Subform2.Table1._Row2.count - 1);

if (Page1.Subform2.Table1._Row2.count <= 0)

{

this.presence = "invisible";

}

and this in the add button click event;

Page1.Subform2.Table1._Row2.addInstance(true);

if (Page1.Subform2.Table1._Row2.count > 0)

{

DeleteLastRow.presence = "visible";

}

Bruce

View solution in original post

0 Replies

Avatar

Correct answer by
Level 10

Hi,

Is this a code fragment from the click event of the "Delete Last Row" button?, I think you just need to swap the "=<" to "<=", this should have given you a syntax error, or is this just from getting the code into the forum?,

Anyway, try this in the delete button click event;

Page1.Subform2.Table1._Row2.removeInstance(Page1.Subform2.Table1._Row2.count - 1);

if (Page1.Subform2.Table1._Row2.count <= 0)

{

this.presence = "invisible";

}

and this in the add button click event;

Page1.Subform2.Table1._Row2.addInstance(true);

if (Page1.Subform2.Table1._Row2.count > 0)

{

DeleteLastRow.presence = "visible";

}

Bruce