+ Start a Discussion
hideawayguyhideawayguy 

commandlink conditional output

hi folks, 

 

i have a custom calendar that outputs a single calendar month with previous and next buttons that will load up the previous or next months when clicked.  it uses a custom controller for the data. 

 

the boss has decided that he DOES NOT want people to be able to click on the previous month button if the selected month is the current month - ie, you can only see this month and months going forward. so, it's august, and i click through to december of this year, i need the previous button to work when i'm on december so i can go back to august, but when i get to august, i need it to be disabled so i can prevent users from going back in time...

 

if basically want to do something like..

 

if (the calendar month == the acutal month) {

disable the commandlink that rerenders the calendar for the previous month

}

 

i just don't know how to do this in visualforce, or maybe i need to do work in the controller?

 

here's the vf page....

 

<apex:form id="theForm">
<apex:outputPanel id="theCalendar" >

<div class="mCalendar" style="width: 100%;" ><div class="topLeft" ><div class="topRight"/></div>
<div class="body">
<table cellspacing="0" cellpadding="1" border="0">
<tbody>
<tr class="header">
<td><apex:commandLink action="{!prev}" rerender="theCalendar">
<img title="Previous Month" class="prevCalArrow" alt="Previous Month" src="/s.gif" />
</apex:commandLink></td>
<td colspan="5" nowrap="nowrap">
{!month.monthname} {!month.yearname}
</td>
<td><apex:commandLink action="{!next}" rerender="theCalendar">
<img title="Next Month" class="nextCalArrow" alt="Next Month"
src="/s.gif" />
</apex:commandLink></td>
</tr>

<tr>
<th scope="col" class="calDays">SUN</th>
<th scope="col" class="calDays">MON</th>
<th scope="col" class="calDays">TUE</th>
<th scope="col" class="calDays">WED</th>
<th scope="col" class="calDays">THU</th>
<th scope="col" class="calDays">FRI</th>
<th scope="col" class="calDays">SAT</th>
</tr>

<apex:repeat value="{!weeks}" var="wk" id="foreachWeek">
<tr class="days">
<!-- or highlight -->
<apex:repeat value="{!wk.days}" var="day" id="foreachday">
<td valign="top"><a class="{!day.CSSName}"
href="{!day.href}" target="_blank"
title="{!day.title}">{!day.displayValue}</a></td>
</apex:repeat>
</tr>
</apex:repeat>

</tbody>
</table>
</div>
<div class="bottomLeft"><div class="bottomRight"/></div>
</div>

</apex:outputPanel>
</apex:form>

 

any help is greatly appreciated....

 

 

 

Best Answer chosen by Admin (Salesforce Developers) 
hideawayguyhideawayguy

found a solution...