+ Start a Discussion
LimitalLimital 

Problems with start Date and End Date when creating a calendar event.

We are trying to make a custom page where the user could create a few meetings related to one person. We want a fastest way to do it with some fixed values.

We have created and event object on the controller and then we add fields form that event to the page, the problem is that when we add the start and end date for the event the page renders it as a non editable field. We have tried many ways to do it and nothing worked.

Anyone has any idea?

Thank you.
Ron HessRon Hess
can you post the code that displays the start and end time, some dates like createddate are read only.
LimitalLimital
Thanks for your answer, I'll post the relevant parts of the code. I am pasting the example only for one meeting creatin, the code is repeated many times for each meeting.
The thing is that I would like to use startdatetime and enddatetime as it is used in the default event creation page, but when I try to use it in my custom page I get the label without the fields.
Any comment?

We are having problems also saving events which are not all day events.... I guess it is something with the dates also but no idea...

THanks.

public class businessTripConfController {

    // Business Meeting Events
    Event businessMeeting;
    Event businessMeeting1;
    Event businessMeeting2;

  SelectOption Duration;
    SelectOption Duration1;
    SelectOption Duration2;

  // businessMeeting #1
    public Event getbusinessMeeting(){
    if(businessMeeting==null ) businessMeeting = new Event(type='Meeting', subject='Meeting');
        return businessMeeting;
    } 
    public void setbusinessMeeting(Event aevent){
        this.businessMeeting = aevent;
    }
  
    // businessMeeting #1
    public Event getbusinessMeeting1(){
    if(businessMeeting1==null ) businessMeeting1 = new Event(type='Meeting', subject='Meeting');
        return businessMeeting1;
    } 
    public void setbusinessMeeting1(Event aevent){
        this.businessMeeting1 = aevent;
    }
  
    // businessMeeting #2
    public Event getbusinessMeeting2(){
    if(businessMeeting2==null ) businessMeeting2 = new Event(type='Meeting', subject='Meeting');
        return businessMeeting2;
    } 
    public void setbusinessMeeting2(Event aevent){
        this.businessMeeting2 = aevent;
    }


<apex:page controller="businessTripConfController" tabStyle="Event">

    <apex:pageBlockSection title="Business Trip Owner">
                <apex:inputField id="busMeetOwner" value="{!businessMeeting.ownerid}"/>
            </apex:pageBlockSection>

              <!-- Business Meeting # 1 -->
            <apex:pageBlockSection id="busMeetSection" title="Business Meeting #1">
                <apex:inputField id="busMeetWho" value="{!businessMeeting.whoid}"/>
                <apex:inputField id="busMeetIsAllDay" value="{!businessMeeting.isalldayevent}" onchange="setRequiredDateTime(this,'{!$Component.busMeetActivityDateTime}','{!$Component.busMeetActivityDate}','{!$Component.busMeetDurations}')"/>
                <apex:inputField id="busMeetActivityDate" value="{!businessMeeting.activitydate}" />
                <apex:inputField id="busMeetActivityDesc" value="{!businessMeeting.description}"/>
            
THE PROBLEM IS HERE, INSTEAD OF USING THIS ITEMS AND MAKING ALL THE SCRIPT FOR THE DURATION I WOULD LIKE TO USE EndDateTime and StartDateTime

  <apex:inputField id="busMeetActivityDateTime" value="{!businessMeeting.activitydatetime}" />                
                <apex:selectList id="busMeetDurations"size="1" multiselect="false" value="{!duration}">
                    <apex:selectOptions value="{!durations}"/>
                </apex:selectList>
                <script>
                    var d = document.getElementById("{!$Component.busMeetActivityDateTime}");
                    var e = document.getElementById("{!$Component.busMeetDurations}");
                    var f = document.getElementById("{!$Component.busMeetIsAllDay}");
                    var g = document.getElementById("{!$Component.busMeetActivityDate}");
                   
                </script>               
            </apex:pageBlockSection>


code continuesss.... but it isnt important...

vasvas
I'm wondering if there's a solution to this yet. Is this per design or a problem in Visualforce?