Planet PDF Forum Planet PDF Forum
  New Posts New Posts RSS Feed - Change text color based on a calculated value
  FAQ FAQ  Forum Search   Register Register  Login Login

Hi, welcome to the Foxit Planet PDF Forum. If you have PDF or Adobe Acrobat questions then the right place to ask them is here, in this forum.

Change text color based on a calculated value

 Post Reply Post Reply
Author
bdavis View Drop Down
New Member
New Member


Joined: 21 Feb 2014
Points: 16
Post Options Post Options   Quote bdavis Quote  Post ReplyReply Direct Link To This Post Topic: Change text color based on a calculated value
    Posted: 21 Feb 2014 at 5:38pm
Hello everyone,

I've created a claim form which should be filled out on the computer, but some people insist on printing it out and filling it out by hand.

There are 11 fields for individual claims (TotalClaimed1 through TotalClaimed11), and they are all totaled in another field (FSA_Total)

I've set the FSA_Total text color to default to white, so if it is printed, it appears blank, instead of showing 0.00. I would like to change the text to black is the value in FSA_Total is not zero.

Here is the custom calculation script:



var claim1 = this.getField('TotalClaimed1'),
    claim2 = this.getField('TotalClaimed2'),
    claim3 = this.getField('TotalClaimed3'),
    claim4 = this.getField('TotalClaimed4'),
    claim5 = this.getField('TotalClaimed5'),
    claim6 = this.getField('TotalClaimed6'),
    claim7 = this.getField('TotalClaimed7'),
    claim8 = this.getField('TotalClaimed8'),
    claim9 = this.getField('TotalClaimed9'),
    claim10 = this.getField('TotalClaimed10'),
    claim11 = this.getField('TotalClaimed11'),
    fsabox = 0;

if (this.getField('Group1').value == 'FSA') {
    fsabox += claim1.value;
}
if (this.getField('Group2').value == 'FSA') {
    fsabox += claim2.value;
}
if (this.getField('Group3').value == 'FSA') {
    fsabox += claim3.value;
}
if (this.getField('Group4').value == 'FSA') {
    fsabox += claim4.value;
}
if (this.getField('Group5').value == 'FSA') {
    fsabox += claim5.value;
}
if (this.getField('Group6').value == 'FSA') {
    fsabox += claim6.value;
}
if (this.getField('Group7').value == 'FSA') {
    fsabox += claim7.value;
}
if (this.getField('Group8').value == 'FSA') {
    fsabox += claim8.value;
}
if (this.getField('Group9').value == 'FSA') {
    fsabox += claim9.value;
}
if (this.getField('Group10').value == 'FSA') {
    fsabox += claim10.value;
}
if (this.getField('Group11').value == 'FSA') {
    fsabox += claim11.value;
}
event.value = fsabox;


-------------------------

I tried adding the code below, but it doesn't work like I thought it would.

if (fsabox==0)
{
this.textColor = color.white;
}
else
{
this.textColor = color.black;
}

---------------------------

Any idea what's preventing the text color from changing from white to black when the value is not 0?

Thanks in advance!
Back to Top
Horndoggie View Drop Down
Senior Member
Senior Member
Avatar

Joined: 15 Jul 2011
Location: USA
Points: 758
Post Options Post Options   Quote Horndoggie Quote  Post ReplyReply Direct Link To This Post Posted: 21 Feb 2014 at 5:41pm
//if total is zero suppress the zero
//place in custom validation
if(event.value==0)event.value="";
Doug
Back to Top
bdavis View Drop Down
New Member
New Member


Joined: 21 Feb 2014
Points: 16
Post Options Post Options   Quote bdavis Quote  Post ReplyReply Direct Link To This Post Posted: 21 Feb 2014 at 5:47pm
Thanks!
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.10
Copyright ©2001-2017 Web Wiz Ltd.

This page was generated in 0.047 seconds.