Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Change table cell colour depending on data entered

Avatar

Level 3

Hi, I have a table in a form and I want the cells to have a darkened colour in each cell if it has no data entered but the cell background colour to change to white if any text is entered in the cell. Is there any way of doing this?  Thanks.

1 Accepted Solution

Avatar

Correct answer by
Level 9

You can use the fillColor property to do that. It depends on your table structure how are you gonna do this. If you have relatively small table lets say 3 columns. 3 rows then in each cell exit/calculate event you can put the following script.

if (Cell1.rawValue == null && Cell2.rawValue == null && Cell3.rawValue == null)
{
  Row1.fillColor = "255,0,0";
}
else{
  Row1.fillColor = "255,255,255";
}  

If you have got a bigger table, then you need to create a function for that.

Thanks,

Bibhu.

View solution in original post

2 Replies

Avatar

Correct answer by
Level 9

You can use the fillColor property to do that. It depends on your table structure how are you gonna do this. If you have relatively small table lets say 3 columns. 3 rows then in each cell exit/calculate event you can put the following script.

if (Cell1.rawValue == null && Cell2.rawValue == null && Cell3.rawValue == null)
{
  Row1.fillColor = "255,0,0";
}
else{
  Row1.fillColor = "255,255,255";
}  

If you have got a bigger table, then you need to create a function for that.

Thanks,

Bibhu.

Avatar

Level 3

Thanks Bibhu - that worked perfectly.