Change Fill Color Based On Value | Community
Skip to main content
April 2, 2010
Solved

Change Fill Color Based On Value

  • April 2, 2010
  • 13 replies
  • 19601 views

I have found several good examples on how to modify the color of a field based on a value but am not having luck implementing.  My form is an evaluation with 3 sections of test scores, the total of all 3 could have a max value of 100.  Sections 1 & 2 are auto calculated, and section 3 is a value the user will input based on their review of all comments, scores, etc.  The final score has a rating, Outstanding 90-100, Satisfactory 70 - 89, and Unsatisfactory <=70.   Right now I'm not so much concerned about the color numbers, but I'm not able to get the colors to change at all.  Because this field is calculated based on sections 1-3, I put the code on its change event.  Once the user enters the final manual score in section 3, the value automatically changes.  I've also tried the exit event of the section 3 manual score, and obviously do not have either the code or where to place it right.  Below is the code I'm using, and would appreciate any help.  If I can learn how to do the 90-100, hopefully I can apply same method, different color to 70-89 and under 70.  What am I doing wrong?  Thank you.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Kevin_Cavallo

I have an example for you, but it looks like uploading has been disabled again.  Send me a direct email with your email address and I'll send you the document.

13 replies

April 6, 2010

1. Work very well, thank you all

2. Works well, but is it possible to change the notification to the user if he/she enters a value out of the specified range? The one thats cones up now isn't wery useful.

April 6, 2010

In the Object/Value properties, there is a Validation Pattern Message and Validation Script Message.  I am not sure the difference, hopefully someone can help, but I put my custom message on the Validation Script Message, and it seems to work.

Level 2
April 9, 2010

Try this java script for the third numeric field calculate event

var

num=Num1.rawValue*Num2.rawValue;

(num>=7)

="255,0,0";

if(num<7 && num>=5)

="0,0,255";

if (num==0)

=null;

="0,255,0";

=num;

To set the maximum input value again you have to write a java script for the corresponding filed

}

this.rawValue

{

this.fillColor

else

}

{

this.fillColor

else

//check for zero value..initially numeric fir=eld will have the value zero and it will show color so to avoid add this line of cde

}

{

this.fillColor

else

}

{

this.fillColor

if