Question

I have recently started playing around with sites and created a basic page.

<apex:page controller="newController">

    <apex:form >

    <apex:pageBlock title="Welcome {!$User.FirstName}"></apex:pageBlock>


    <apex:pageBlock mode="edit">

        <apex:pageBlockSection title="Travel Details" >

           <apex:inputField value="{!Booking.StartDateTime__c}"></apex:inputField>

            <apex:inputText value="{!Booking.EndDateTime__c}"></apex:inputText>

            <apex:inputField value="{!Booking.StartLocation__c}"></apex:inputField>

            <apex:inputField value="{!Booking.EndLocation__c}"></apex:inputField> 

     </apex:pageBlockSection>

    </apex:form>

These are the two fields that I display - one problem though, when a user clicks on the field the calendar fails to popup, they are just acting as a normal textbox.

I have searched on the web and checked user and field level permissions and everything seems to be fine. They are of the datatype datetime.

So does anyone know how I can get this calendar to display?

EDIT: I have made the code remedies suggested but unfortunately had no luck. The inputfield now displays the current date time next to the input box(as in salesforce) but still no calendar popup. I have also built the controller. Possibly a javascript issue?

Any help much appreciated, Cheers

Was it helpful?

Solution 3

I figured it out, if anyone comes across the same issue you need to activate the site.

Anyway thanks for all the responses.

OTHER TIPS

You need to define a standard controller and wrap your inputfield in a form in order to get the calendar to pop up, the code should look like this

<apex:page standardController="Booking__c">
  <apex:form >
    <apex:inputfield value="{!Booking__c.StartDateTime__c}"/>
    <apex:inputfield value="{!Booking__c.EndDateTime__c}"/>
  </apex:form>
</apex:page>

Try inputText instead:

Note: Read-only fields, and fields for certain Salesforce objects with complex automatic behavior such as Event.StartDateTime and Event.EndDateTime, don't render as editable when using <apex:inputField>. Use a different input component such as <apex:inputText> instead.

Source: apex:inputField (Salesforce.com)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top