function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
bensondanielbensondaniel 

onclick Event

Apex repeat function here would repeat the days of the week, iterating from Monday to Sunday also displaying the day alongside.

My problem is in the prevWeek.

prevWeek is a button. (supposed to be)

When it is clicked I want the changes in goprev to take place.

I need wcTopBar to display the previous weeks days.

 

Pl take a look at

 <apex:actionSupport event="onclick" action="{!goprev}" rerender="wcTopBar" />  

and let me know what is deficient to do the job.

 

 

<apex:outputPanel id="wcTopBar" layout="block" styleClass="containerAD noscroll" style="height: 37px;">
                                    <div class="overflowContainer">    
                                        <div class="weekLabels">
                                            <apex:repeat value="{!daysOfWeek}" var="d">
                                                <div class="{!d.divClass}">
                                                  ​  <div><span style="{!d.spanStyle}"><apex:outputText value="{!d.dayName}" escape="false" /></span></div>
                                                  ​      </div>
                                            </apex:repeat>

__________________________________________________​_

<div class="prevWeek" id="prevweek">
                                            <a class="small left _background1 _border1 _background1Hover t_btn">
                                                <img src="{!URLFOR($Resource.Library, 'images/prev.png')}" width="13" height="28" />
                                                <apex:actionSupport event="onclick" action="{!goprev}" rerender="wcTopBar" />   
                                              </a>
                                        </div>
__________________________________________________​____________________

 

public class calendarController{

  public List<dayInfo> daysOfWeek {get;set;}

   Date pw;

 public calendarController(){
        daysOfWeek = new List<dayInfo>();
        pw = system.Today().toStartOfWeek();
        daysOfWeek = calUtil.buildDaysOfWeek(pw);
}

public PageReference goprev(){
        pw = system.Today().toStartOfWeek().addDays(-7);
        daysOfWeek = calUtil.buildDaysOfWeek(pw);
        return null;
    }

 

public PageReference goprev(){
        pw = system.Today().toStartOfWeek().addDays(-7);
        daysOfWeek = calUtil.buildDaysOfWeek(pw);
        return null;
    }

MandyKoolMandyKool

Hi,

 

Try using <apex:Image> tag instead of <img> tag.

Also, your <apex:ActionSupport> tag should be within the <apex:image> tag.

 

So your VF Page code will look something like this

 

<apex:imge src="{!URLFOR($Resource.Library, 'images/prev.png')}" width="13" height="28" >
        <apex:actionSupport event="onclick" action="{!goprev}" rerender="wcTopBar" /> 

</apex:image>

 

Hope this will work for you!!

 

 

 

bensondanielbensondaniel

I hope this works!!

 

<apex:image src="{!URLFOR($Resource.Library, 'images/prev.png')}" width="13" height="28" >
        <apex:actionSupport event="onclick" action="{!goprev}" rerender="wcTopBar" /> 

</apex:image>

bensondanielbensondaniel

This is not working

 

Error: Unsupported attribute src in <apex:image> in calendar at line 77 column 137

MandyKoolMandyKool

Hi,

 

Use Url property instead of src :D and chk.