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
satheesh psatheesh p 

how to pass value to visual page to apex pageload method??

Hi,

i want to pass radiobutton value to apex pageload.i am using following code to pass  the value But it shows Formula Expression is required on the action attributes after the radio button is clicked.can any one try to resolve the error.

VisualPage

<apex:page cache="false" controller="AppointmentCalendarController" action="{!pageLoad}">
    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
    <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"/>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
         
    <link href="{!$Resource.fullCalendarCSS}" rel="stylesheet" />
    <link href="{!$Resource.fullCalendarPrintCSS}" rel="stylesheet"  media="print"/>
    <script src="{!$Resource.momentMinJS}"></script>
    <script src="{!$Resource.fullCalendarMinJS}"></script>
   
    
    <script>
        //We need to wrap everything in a doc.ready function so that the code fires after the DOM is loaded
        var add_newAppointment = '<img src="{!URLFOR($Resource.Image, 'plus_orange.png')}" onclick = "image_onclick()" /> '; 
        $(document).ready(function() {   
            //Call the fullCallendar method. You can replace the '#calendar' with the ID of the dom element where you want the calendar to go. 
            $('#calendar').fullCalendar({
                header: {
                    left: 'prev,next today',
                    center: 'title',
                    right: 'month,agendaWeek,agendaDay'
                },
                viewRender: function(view,element){
                    $(".fc-day-number").prepend('<img src="{!URLFOR($Resource.Image, 'plus_orange.png')}" onclick = "image_onclick()" /> ');
                   
                }, 
                editable: false,
                events:
                [
                    //At run time, this APEX Repeat will reneder the array elements for the events array
                    <apex:repeat value="{!events}" var="e">
                        {
                            title: "{!e.title}",
                            
                            start: '{!e.startTimeString}',
                            end: '{!e.endTimeString}',
                            url: '{!e.url}',
                           <!--allDay: {!e.allDay},  -->
                            className: '{!e.className}'
                        },
                    </apex:repeat>
                ]
            });
             
        });
    
        function image_onclick() 
        {
            //window.location.href = "apex/TimeSheetNew";
            var dt = $('#selectedDay').val(); 
            //var dt = date.format('YYYY-MM-DD');
            //alert(date.format('MM'));
            var cdate = $('#calendar').fullCalendar('getDate').format('YYYY-MM-DD');
            var start = moment(dt);
            var end = moment(cdate);
            var df = start.diff(end, 'days');
            if(df < -2 )
            {
                alert('Entries on elapsed date is not allowed.');
            }
            else if (df >0 )
            {
                alert('Entries for future date is not allowed.');
            }
            else
            {
               
                    window.open('TimeSheetNew?dt='+ dt + '&source=calendar', '_blank');
               
            }
            
        }
    </script>
     
    <!--some styling. Modify this to fit your needs-->
    <style>
        #cal-options {float:left;}
        #cal-legend { float:right;}
        #cal-legend ul {margin:0;padding:0;list-style:none;}
        #cal-legend ul li {margin:0;padding:5px;float:left;}
        #cal-legend ul li span {display:block; height:16px; width:16px; margin-right:4px; float:left; border-radius:4px;}
        #calendar {margin-top:20px;}
        #calendar a:hover {color:#fff !important;}
         
        .fc-event-inner {padding:3px;}
        .chennai{background:#2EFE2E;border-color:#2EFE2E;}
        .trichy{background:#21CBED;border-color:#21CBED;}
        .erode{background:#cc9933;border-color:#cc9933;}
        .puducherry{background:#FF5190;border-color:#FF0000;}
        .mumbai{background:#9933FF;border-color:#9933FF;}
        .indoor{background:#1967c0;border-color:#1967c0;}
        <!--.Others {background:#E88887;border-color:#E88887;}
        .event-personal {background:#1797c0;border-color:#1797c0;}-->
    </style>
     
    <apex:sectionHeader title="TimeSheet Calendar " >
    
    </apex:sectionHeader>
     <apex:outputPanel id="calPanel"> 
        <apex:form >
                 
           <div id="cal-options">
              <!-- <apex:commandButton value="{!IF(includeMyEvents,'Hide My Events','Show My Events')}" action="{!toggleMyEvents}"/> -->
            </div> 
            <div id="cal-legend">
                <ul>
                    <li style="{!IF(includeMyEvents,'','display:none')}"><span class="chennai"></span>Chennai</li>
                    <li style="{!IF(includeMyEvents,'','display:none')}"><span class="trichy"></span>Trichy</li>
                    <li style="{!IF(includeMyEvents,'','display:none')}"><span class="erode"></span>Erode</li>
                    <li style="{!IF(includeMyEvents,'','display:none')}"><span class="puducherry"></span>Puducherry</li>
                    <li style="{!IF(includeMyEvents,'','display:none')}"><span class="mumbai"></span>Mumbai</li>
                    <li style="{!IF(includeMyEvents,'','display:none')}"><span class="indoor"></span>Indoor</li>
                   <!--  <li style="{!IF(includeMyEvents,'','display:none')}"><span class="Others"></span>Others</li>
                   <li style="{!IF(includeMyEvents,'','display:none')}"><span class="event-personal"></span>My Events</li> -->
                </ul>
                <div style="clear:both;"><!--fix floats--></div>
            </div>
            <div style="clear:both;"><!--fix floats--></div>
            <div class="col-md-2">
                <div class="content-box" id="external-eventslink">
                    <h3 class="content-box-header bg-default">
                        Select Branch
                    </h3>
                    <apex:selectRadio value="{!selectedValue}">
                        <apex:selectOption itemLabel="All Branch" itemValue="Allbranch" ></apex:selectOption>
                        <apex:selectOption itemLabel="Chennai" itemValue="Chennai"></apex:selectOption>
                        <apex:selectOption itemLabel="Trichy" itemValue="Trichy"></apex:selectOption>
                        <apex:selectOption itemLabel="Erode" itemValue="Erode"></apex:selectOption>
                        <apex:selectOption itemLabel="Puducherry" itemValue="Puducherry"></apex:selectOption>
                        <apex:selectOption itemLabel="Mumbai" itemValue="Mumbai"></apex:selectOption>
                        <apex:selectOption itemLabel="Indoor" itemValue="Indoor"></apex:selectOption>
                        
                        <apex:actionSupport event="onchange" action="{!checkSelectedValue}" reRender="none"/>
                     </apex:selectRadio>
                                    </div>
            </div>
            <div class="col-md-10">
            <div name="calendar" id="calendar"></div>
            <input type="hidden" id="selectedDay" /> 
            </div>
            
             
        </apex:form>
    </apex:outputPanel>
</apex:page>

ApexController

public class AppointmentCalendarController{

    public transient Boolean includeMyEvents {get;set;}
    public transient list<calEvent> events {get;set;}
    public string selectedValue{ get; set; }
    public string city{ get; set; }
 
    //The calendar plugin is expecting dates is a certain format. We can use this string to get it formated correctly
    private transient String  dtFormat = 'EEE, d MMM yyyy HH:mm:ss z';
     
    //constructor
    public AppointmentCalendarController() {
    
        includeMyEvents = true;
    }
       
     public string checkSelectedValue(){        
        System.debug('seleced value-----'+selectedValue);        
        return selectedValue;
    } 
       
    public PageReference pageLoad() {
        city = checkSelectedValue();
        System.debug('Selected city: '+selectedValue);
        events = new list<calEvent>();
          if(includeMyEvents)
          {  
           for(Appointment__c app: [select Id, Name, Branch__c, Services__c,Start_Time__c,End_Time__c from Appointment__c WHERE Branch__c = city ])
           // for(Appointment__c app: [select Id, Name, Branch__c, Services__c from Appointment__c])
            {
               
                calEvent myEvent = new calEvent();
                 
                myEvent.title = app.Branch__c;
                
                    myEvent.startTimeString = app.Start_Time__c.format('MM/dd/yyyy HH:mm:ss');
                    myEvent.endTimeString = app.End_Time__c.format('MM/dd/yyyy HH:mm:ss');
                    myEvent.url = '/' + app.Id;
                
                myEvent.className = app.Services__c;
                events.add(myEvent);
            }
        }
        return null;
    }
    
    public PageReference toggleMyEvents()
     {
        if(includeMyEvents){
            includeMyEvents = false;
        }
        else{
            includeMyEvents = true;
        }
        pageload();
        return null;
    }    
 
     
    //Class to hold calendar event data
    public class calEvent
    {
        public String title {get;set;}
        //public Boolean allDay {get;set;}
        public String appointmentDateString {get;set;}
        public String startTimeString {get;set;}
        public String endTimeString {get;set;}
        public String url {get;set;}
        public String className {get;set;}
    }
}

waiting for response..

Thank you...