Reset field color format after manual update of formula driven autopopulate.
I have created a document where certain fields are updated based on triggers in other fields. Part of this update includes changing color formatting from black on white to white on black. The autopopulated fields are updated as the trigger fields are also updated. I have also added the ability for users to manually override the autopopulated data. (4 wins)
After an autopopulated field has been manually updated, I need the color formatting to return to black on white.
I'm not sure where I'm missing, and I may be double dipping. Here is the scripting I've put together for the calculation, validation and keystroke.
CALCULATION:
event.rc = !event.target.bDetect
var v = this.getField("Award Value").valueAsString;
var z = this.getField("USG").value;
if (z=="NO")
{
event.value = " NOT A USG CONTRACT";
event.target.textColor=color.white
event.target.fillColor=color.black
}
else
if (v<10000000)
{
event.value = " BELOW THRESHOLD REQUIREMENT ";
event.target.textColor=color.white
event.target.fillColor=color.black
}
else
if (z!=="NO" && event.value==" NOT A USG CONTRACT")
{
event.target.value=""
event.target.textColor=color.black
event.target.fillColor=color.transparent
}
else
if (v>=10000000 && event.value==" BELOW THRESHOLD REQUIREMENT ")
{
event.target.value=""
event.target.textColor=color.black
event.target.fillColor=color.transparent
}
else
if (v>=10000000 && event.value!="")
{
SetFieldValues(event.value)
event.target.textColor=color.black
event.target.fillColor=color.transparent
}
VALIDATE:
event.rc = true;
if (event.value!== " BELOW THRESHOLD REQUIREMENT ")
{
event.target.fillcolor=color.WHITE
event.target.textcolor=color.BLACK
}
else
if (event.value!==" NOT A USG CONTRACT")
{
event.target.fillcolor=color.WHITE
event.target.textcolor=color.BLACK
}
else
{
event.target.fillcolor=color.BLACK
event.target.textcolor=color.WHITE
}
KEYSTROKE:
if(!event.willCommit)event.target.bDetect = true;else if(event.value == "")event.target.bDetect = false;
