cancel
Showing results for 
Search instead for 
Did you mean: 

How to change cell color dynamically in adobe forms??? Pls do needful

Former Member
0 Kudos

How to change cell color dynamically in adobe forms??? Pls do needful

Accepted Solutions (0)

Answers (2)

Answers (2)

chris_scott
Active Participant

HI Deepak,

The code you need looks like:

this.border.fill.color.value = "231,254,254";

With FLM we supply various JavaScript functions that make this kind of thing easy.

For field highlighting on enter / exit, for example we would add the code:

soFLMtools.fieldHighlight(this.somExpression

, xfa.event.name);

This passes in the som expression of the current field along with the current event name into the function 'field highlight' in the script object soFLMtools.

We store this JavaScript snippets in the SAP back-end and inject them into the form at run-time so that you don't need to maintain them on each form template.

The function looks like:

function fieldHighlight(somExp,strEvent)
{
var fAccess = xfa.resolveNode(somExp).access ;
if (fAccess == "readOnly" || fAccess == "protected" ) return;
//Check if the field is in a table cell
if( xfa.resolveNode(somExp).parent.layout == "row")
{
  // Set the border thickness to thin in case it was highlighted by a validation check
  xfa.resolveNode(somExp).border.edge.thickness = "0.0069";
 
  if (strEvent == "enter")
  {
   // Table cell enter
   // Highlight the field and ensure the border is the correct colour.
   xfa.resolveNode(somExp).border.fill.color.value = COLOR_HIGHLIGHT.value;
   xfa.resolveNode(somExp).border.edge.color.value = COLOR_BOX.value;

  }
  else if (strEvent == "exit") 
  {
   // Table cell exit
   // Remove the field highlight
   xfa.resolveNode(somExp).border.fill.color.value = COLOR_WHITE.value;
  }
}
else
{
  // Set the border thickness to thin in case it was highlighted by a validation check
  xfa.resolveNode(somExp).ui.oneOfChild.border.edge.thickness = "0.0069";

  if (strEvent == "enter")
  {
   // Field enter
   // Highlight the field and ensure the border is hidden
   xfa.resolveNode(somExp).ui.oneOfChild.border.fill.color.value = COLOR_HIGHLIGHT.value;
   xfa.resolveNode(somExp).border.edge.presence = "invisible";
  }
  else if (strEvent == "exit")
  {
   // Field exit
   // Remove the field highlight
   xfa.resolveNode(somExp).ui.oneOfChild.border.fill.color.value = COLOR_WHITE.value;
  }
}
}

Best regards,

Chris

Former Member
0 Kudos

Hi Deepak,

Please post this question in the adobe forms space at http://scn.sap.com/community/interactive-forms-by-adobe

cheers,

Ohad