Welcome, Guest. Please login or register.
Did you miss your activation email?


Login with username, password and session length

Search

 
Advanced search

8054 Posts in 1860 Topics- by 2099 Members - Latest Member: roi
Calendar Script CommunityCustomizationCustomizing CalendarScript (Moderators: scott, DanO, Marty)Changing Cell BGCOLOR based on Added Field
Pages: [1]   Go Down
Print
Author Topic: Changing Cell BGCOLOR based on Added Field  (Read 352 times)
0 Members and 1 Guest are viewing this topic.
drhurd
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« on: April 05, 2006, 03:49:00 AM »

I have added a "Status" Select Box field with three options Booked, Available and Not Available. I would like to change the bgcolor based on the "Status" field.

I have used the following code in default.html to be able to have the text background be based on the "Status" field and it works fine, but I would prefer to chnage the color of the entire cell rather than just the text background:

<% if ($EVENT->{details}->{status} eq "booked") {$color="#FF9999";}
elsif ($EVENT->{details}->{status} eq "available") {$color="#00FF00";}
elsif ($EVENT->{details}->{status} eq "notavailable") {$color="#00FF00";}
else {$color="#FFFFFF";}%>
<span style="background:<%=$color%>">

I have a working calendar at http://www.vtsr.com/renoCalendar3.htm  that I am experimenting on.

Thanks
Doug

[This message has been edited by drhurd (edited April 05, 2006).]

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 235

Please don't PM me. Post in the open forum.


WWW
« Reply #1 on: April 05, 2006, 01:16:00 PM »

** I would prefer to change the color of the entire cell rather than just the text background **

That will be pretty difficult to do IMO as the start of the table HTML code (where the background color would need to be specified) is printed before any of the event data is evaluated.

The only way I can see being able to do it is loop through the day's events *at the time of printing the table TD tag*, and then loop through them again to print them out. I'm afraid I have no idea of what code would be needed to accomplish it.  

Dan O.

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

Logged
drhurd
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #2 on: April 05, 2006, 05:02:00 PM »

Dan:

AS you can see from the page at http://www.vtsr.com/renoCalendar3.htm  I am able to change the BGCOLOR based on whether there is an event or not, so I would have thought we should be able to evaluate the "Status" field for BGCOLOR. Red for booked, green for available...etc etc What am I missing.

Thank you very much for your help. We will be buying the software.

Doug

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

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 235

Please don't PM me. Post in the open forum.


WWW
« Reply #3 on: April 05, 2006, 06:21:00 PM »

** I am able to change the BGCOLOR based on whether there is an event or not **

Sure, that's easy!

But getting into that array of events and looking for a specific value in one event field is different. That's what the loop I talked about would do, look though each of the events on that date, for a particular value in a single event's details. I don't know how the event detail's values could be accessed randomly without looping through them. Sorry.

Dan O.

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

Logged
Pages: [1]   Go Up
Print
Jump to: