font color

Use this board to ask questions or have discussions with other Rich Displays users.
Post Reply
ppbedz
Experienced User
Posts: 147
Joined: Tue Jun 17, 2014 4:00 pm
First Name: Patti
Last Name: Bednarz
Company Name: McGard
State / Province: New York
Country: United States
Contact:

font color

Post by ppbedz »

I am writing a function to retrieve the font color of a button and perform some logic. The following javascript statement to retrieve the font color of the button in a grid row does not seem to be correct. It produces a pop-up error that says "undefined". Any help would be appreciated,,, Patti

var BtnAccColor = getObj("B_Accept" + "." + row).pui.properties["color"];
User avatar
Glenn
Profound Logic Staff Member
Posts: 124
Joined: Mon Apr 14, 2014 4:08 pm
First Name: Glenn
Last Name: Hopwood
Company Name: Profound Logic Software
State / Province: Ohio
Country: United States
Contact:

Re: font color

Post by Glenn »

Patti,

I have a couple of questions before I can assist here.

- How is the font color being set? Are you using the 'color' property of the widget? Is it being set by a CSS rule?
- When you say you get a pop-up that says "undefined" is that from an alert(); you are doing in your code or is it a browser pop-up?

Just as an aside, since it's possible for the end user to adjust colors in the browser without your permission/knowledge I would avoid depending on this value for any important logic. It might be better to 'key' on data that you are certain of. Perhaps a hidden field or the 'user defined data' property?

Glenn
ppbedz
Experienced User
Posts: 147
Joined: Tue Jun 17, 2014 4:00 pm
First Name: Patti
Last Name: Bednarz
Company Name: McGard
State / Province: New York
Country: United States
Contact:

Re: font color

Post by ppbedz »

Hi Glenn,

I have 2 buttons in a grid row. One says "accept" and the other says "decline". The grid is going to list employee vacation requests. The manager will click either the accept or decline. If accept, I want the button text to be green, if decline is clicked, I want the text to be red. The default on both will be gainsboro and the unclicked button will remain gainsboro. I chose this so the user would have an easy visual of what was being accepted or declined. I am writing a function to change the font colors using javascript. I thought I could just change the property attribute to the appropriate color, however I can't seem to even retrieve what it is to start out with. I have an alert directly after the statement I originally posted so I can see what it retrieves. I believe that is throwing the pop-up. This is what I have so far: (the ".clicked" would not work either) Thanks, Patti


function clkooauth(row) {

//var BtnAccClick = getObj("B_Accept" + "." + row).clicked;
//alert(BtnAccClick);
//var BtnDecClick = getObj("B_Decline" + "." + row).clicked;
var BtnAccColor = getObj("B_Accept" + "." + row).pui.properties["color"];
alert(BtnAccColor);
var BtnDecColor = getObj("B_Decline" + "." + row).pui.properties["color"];
var AccColor = "#0ca81d";
var DecColor = "b11919";
var DefColor = "gainsboro";



// Set the accept/decline buttons


//if (BtnAccClick == true)

//{
if (BtnAccColor = "gainsboro")
{
BtnAccColor = AccColor;
}
else
{
BtnAccColor = DefColor;
}

// }


getObj("B_Accept" + "." + row).style.Color=BtnAccColor;



}
ppbedz
Experienced User
Posts: 147
Joined: Tue Jun 17, 2014 4:00 pm
First Name: Patti
Last Name: Bednarz
Company Name: McGard
State / Province: New York
Country: United States
Contact:

Re: font color

Post by ppbedz »

Glenn,

I am all set. I needed to use style.color instead of pui.properties

Thank you,
Patti
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests