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
naresh johnnaresh john 

Calendar is not coming in <apex:inputfield> tag

HI every body,

 

     I have  

<apex:inputfield value="{!Eventinfo_startDT.Start_date_and_time__c}" id="Eventinfo_StartDTTest"/>  this line in my visualforce page. The value in inputfield tag is datetime datatype. 
    Before, when I click in the textbox, calendar was appearing to select the date. But now when I click in the textbox calendar is not coming. I think there is some issue in it.
   I spend a lot of time to resolve the issue, but unable to resolve. Can some body please help me regarding this.
Thanks,
Naresh
                        
            

 

Best Answer chosen by Admin (Salesforce Developers) 
MandyKoolMandyKool

Hi,

 

I have checked your code and it worked for me.

Have you checked for any javascript errors. It may happen that coz of javascript errors the calender is not loading.

All Answers

@imtimran.ax982@imtimran.ax982

Yes, this is the same issue we are facing.

someone from salesforce team should respond and look at this with priority.

MandyKoolMandyKool

Hi,

 

Could you paste the controller code for "{!Eventinfo_startDT.Start_date_and_time__c}" ?

super developersuper developer

Earlier i have also got this problem.But there i overcome with overriding new button with another vfpage

MandyKoolMandyKool

Hi,

 

I think if you are using the "Custom Controller" then you need to bind some dummy object with the <apex:inputField> for DateTime. If you are using the standard controller then the calender should come or may be some problem related with the browser.

 

If you could post your controller code here, that can be helpful.

super developersuper developer

yes I used Custom controller.

naresh johnnaresh john

My controller code

Public with sharing class Create_Events{
public string Eventinfo_name{get; set;}
public string Eventinfo_title{get; set;}
public string Eventinfo_category{get; set;}
public string Eventinfo_description {get ; set ;}
public string Eventinfo_agenda {get ; set ;}
public event__c Eventinfo_startDT{ get ; set ;} 
public event__c Eventinfo_endDT{ get ; set ;}
public string Eventinfo_timezone{ get ; set ;}
public event__c Eventinfo_publishdate{ get ; set ;}

public string Eventadd_location {get ; set ;}
public string Eventadd_address {get ; set ;}
public string Eventadd_city {get ; set ;}
public string Eventadd_state {get ; set ;}
public string Eventadd_zipcode{get ; set ;}
public string Eventadd_country{get ; set ;}
public string Eventadd_phone{get ; set ;}
public boolean Eventadd_display_on_registration {get ; set ;}

public string Eventorg_organization{get ; set ;}
public string Eventorg_owner{get ; set ;}
public string Eventorg_owneremail{get ; set ;}
public boolean Eventorg_display_on_registration {get ; set ;}

public string Eventfee_feeamount{get ; set ;}
public boolean Eventfee_peoplediscount{get ; set ;}
public boolean Eventfee_datediscount{get ; set ;}
public boolean Eventfee_coupondiscount{get ; set ;}

event__c Cal=new event__c();
public event__c getShowcal(){
return Cal;
}

string Eventfee_detail='No fee';
public String getEventfee_detail() {return Eventfee_detail;}
public void setEventfee_detail(String Eventfee_detail) {this.Eventfee_detail= Eventfee_detail; }



public List<SelectOption> getEventCategories()
{
                    List<SelectOption> options = new List<SelectOption>();
        
                    Schema.DescribeFieldResult fieldResult =
                    event__c.Event_category__c.getDescribe();
                    List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();
        
                    for( Schema.PicklistEntry f : ple)
                       {
                                  options.add(new SelectOption(f.getLabel(), f.getValue()));
                       }       
                    return options;
}
public List<SelectOption> getEventTimezone()
{
                    List<SelectOption> options = new List<SelectOption>();
        
                    Schema.DescribeFieldResult fieldResult =
                    event__c.Time_zone__c.getDescribe();
                    List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();
        
                    for( Schema.PicklistEntry f : ple)
                       {
                                  options.add(new SelectOption(f.getLabel(), f.getValue()));
                       }       
                    return options;
}
public List<SelectOption> getFeedetails()
{
                    List<SelectOption> options = new List<SelectOption>();
        
                    Schema.DescribeFieldResult fieldResult =
                    event__c.Registration_fee__c.getDescribe();
                    List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();
        
                    for( Schema.PicklistEntry f : ple)
                       {
                                  options.add(new SelectOption(f.getLabel(), f.getValue()));
                       }       
                    return options;
}
 
}

Visualforce page code is

 

 

 

<apex:page controller="Create_Events" extensions="AddCustomQuestions">
<style>
.DisplayClass{
background-color:#CC0000;
display:none;

}
.discountclass {

padding-top:15px;
padding-bottom:15px;
}
</style>
<script>
window.onload = new function() { datediscount(); };

var displayDDbutton=document.getElementById('{!$Component.CreateAnEvent.block.Eventpriceinfo.EFeeAmount.DateDiscount.datediscountbutton}').style.display='none';
var displayDDlabel=document.getElementById('{!$Component.CreateAnEvent.block.Eventpriceinfo.EFeeAmount.DateDiscount.datediscountlabel}').style.display=DisplayClass;

function IsValidate(theform){

var Ename=document.getElementById('{!$Component.CreateAnEvent.block.EventInfo.Ename.Eventinfo_name}').value;
var datediscount=document.getElementById('{!$Component.CreateAnEvent.block.Eventpriceinfo.EFeeAmount.EFeedatediscount.Eventfee_datediscount}').checked;
return false;
}
function datediscount(){


}
</script>
  <apex:form id="CreateAnEvent">
  <apex:sectionHeader title="Create an event"/>
  <apex:pageMessages />
        <apex:pageblock id="block" >
                        <apex:pageBlockSection id="EventInfo" title="Event information" columns="1" collapsible="false">
                                <apex:pageblocksectionItem id="Ename">
                                        <apex:outputlabel value="Event name" for="Event name" />
                                        <apex:inputText value="{!Eventinfo_name}" size="50" id="Eventinfo_name"/>
                                </apex:pageblocksectionItem>
        
                                <apex:pageblocksectionItem id="Ecategory">
                                        <apex:outputlabel value="Event category" for="Event category" />
                                        <apex:selectList id="Event_category" value="{!Eventinfo_category}" size="1" required="true">                               
                                        <apex:selectOptions value="{!EventCategories}" />
                                        </apex:selectList>
                                </apex:pageblocksectionItem>
                                <apex:pageblocksectionItem id="Edesc">
                                        <apex:outputlabel value="Event description" for="Event description" />
                                        <apex:inputTextarea value="{!Eventinfo_description}" rows="5" cols="55" id="Eventinfo_description"/>
                                </apex:pageblocksectionItem>
                                <apex:pageblocksectionItem id="Eagenda">
                                        <apex:outputlabel value="Event agenda" for="Evnet agenda" />
                                        <apex:inputTextarea value="{!Eventinfo_agenda}" rows="5" cols="55" id="Eventinfo_agenda"/>
                                </apex:pageblocksectionItem>
                                <apex:pageblocksectionItem id="EstartDT">
                                        <apex:outputlabel value="Start date time" for="Event start date and time" />
                                       
                                        <apex:inputfield value="{!Eventinfo_startDT.Start_date_and_time__c}" id="Eventinfo_StartDT"/>
                                        
                                </apex:pageblocksectionItem>
                                <apex:pageblocksectionItem id="EendDT">
                                        <apex:outputlabel value="End date time" for="Event end date and time" />
                                        <apex:inputfield value="{!Eventinfo_endDT.End_date_and_time__c}" id="Eventinfo_endDT"/>
                                </apex:pageblocksectionItem>
                                <apex:pageblocksectionItem id="Epublishdate">
                                        <apex:outputlabel value="Publish date" for="Evet publish date" />
                                        <apex:inputfield value="{!Eventinfo_publishdate.Publish_date__c}" id="Eventinfo_publishdate"/>
                                </apex:pageblocksectionItem>
                        </apex:pageBlockSection>
                        <apex:pageBlockSection id="Timezoneinfo" title="Time Zone" columns="1" collapsible="false">
                                <apex:pageblocksectionItem id="ETimezone">
                                        <apex:outputlabel value="Time zone" for="Event timezone" />
                                        <apex:selectList id="Event_timezone" value="{!Eventinfo_timezone}" size="1" required="true">                            
                                        <apex:selectOptions value="{!EventTimezone}" />
                                        </apex:selectList>
                                </apex:pageblocksectionItem>       
                        </apex:pageBlockSection>
                        <apex:pageBlockSection id="Eventaddinfo" title="Event address" columns="2" collapsible="false">
                                <apex:pageblocksectionItem id="Edlocation">
                                        <apex:outputlabel value="Location" for="Event location" />
                                        <apex:inputText value="{!Eventadd_location}" id="Eventadd_location"/>
                                </apex:pageblocksectionItem>
                                <apex:pageblocksectionItem id="Edaddress">
                                        <apex:outputlabel value="Address" for="Event name" />
                                        <apex:inputText value="{!Eventadd_address}" id="Eventadd_address"/>
                                </apex:pageblocksectionItem>
                                <apex:pageblocksectionItem id="Edcity">
                                        <apex:outputlabel value="City" for="Event city" />
                                        <apex:inputText value="{!Eventadd_city}" id="Eventadd_city"/>
                                </apex:pageblocksectionItem>
                                <apex:pageblocksectionItem id="Edsate">
                                        <apex:outputlabel value="State" for="Event state" />
                                        <apex:inputText value="{!Eventadd_state}" id="Eventadd_state"/>
                                </apex:pageblocksectionItem>
                                <apex:pageblocksectionItem id="Edzipcode">
                                        <apex:outputlabel value="Zip code" for="Event zipcode" />
                                        <apex:inputText value="{!Eventadd_zipcode}" id="Eventadd_zipcode"/>
                                        </apex:pageblocksectionItem>
                                <apex:pageblocksectionItem id="Edcountry">
                                        <apex:outputlabel value="Country" for="Event country" />
                                        <apex:inputText value="{!Eventadd_country}" id="Eventadd_country"/>
                                </apex:pageblocksectionItem>
                                <apex:pageblocksectionItem id="Edphone">
                                        <apex:outputlabel value="Phone" for="Event phone" />
                                        <apex:inputText value="{!Eventadd_phone}" id="Eventadd_phone"/>
                                </apex:pageblocksectionItem>
                                <apex:pageblocksectionItem id="Eddisplay">        
                                        <apex:inputcheckbox value="{!Eventadd_display_on_registration}" id="Eventadd_display"/>
                                        <apex:outputlabel value="Display address on registration form" for="Event address display" />
                                </apex:pageblocksectionItem>        
                        </apex:pageBlockSection>
                        <apex:pageBlockSection id="Eventorginfo" title="Event organizer" columns="2" collapsible="false">
                                <apex:pageblocksectionItem id="EoOrg">
                                        <apex:outputlabel value="Organization" for="Event Orgnization" />
                                        <apex:inputText value="{!Eventorg_Organization}" id="Eventorg_Organization"/>
                                </apex:pageblocksectionItem>
                                <apex:pageblocksectionItem id="EoOwner">
                                        <apex:outputlabel value="Owner" for="Event Owner" />
                                        <apex:inputText value="{!Eventorg_owner}" id="Eventorg_owner"/>
                                </apex:pageblocksectionItem>
                                <apex:pageblocksectionItem id="EoOwnermail">
                                        <apex:outputlabel value="Owner email" for="Event Owneremail" />
                                        <apex:inputText value="{!Eventorg_owneremail}" id="Eventorg_owner"/>
                                </apex:pageblocksectionItem>
                                <apex:pageblocksectionItem id="Eodisplay">        
                                        <apex:inputcheckbox value="{!Eventorg_display_on_registration}" id="Eventorg_display"/>
                                        <apex:outputlabel value="Display this on registration form" for="Event org display" />
                                </apex:pageblocksectionItem>
                        </apex:pageBlockSection>
                        <apex:pageBlockSection id="Eventpriceinfo" title="Price settings" columns="1" collapsible="false">
                                <apex:pageblocksectionItem id="EFee">        
                                        <apex:selectRadio id="Event_fee" value="{!Eventfee_detail}" required="true">
                                        <apex:actionSupport event="onchange" reRender="Feeamount" />                                
                                        <apex:selectOptions value="{!Feedetails}"/>
                                        </apex:selectRadio>        
                                </apex:pageblocksectionItem>
                                <apex:pageblocksectionItem id="EFeeAmount"> 
                                <apex:outputpanel id="Feeamount">
                                <apex:outputpanel rendered="{!Eventfee_detail == 'Fee'}">
                                 
                                        <apex:pageblocksectionItem id="EFeeAmount"> 
 
                                                  <apex:outputlabel value="Fee amount" for="fee amount" />
                                                  <apex:inputText value="{!Eventfee_feeamount}" style="position:relative;left:67px;" id="Eventfee_feeamount"/>
                                         </apex:pageblocksectionItem> <br /><br />
                                         <apex:pageblocksectionItem id="EFeedatediscount"> 
 
                                        <apex:inputcheckbox value="{!Eventfee_datediscount}" id="Eventfee_datediscount">
                                        <apex:actionSupport event="onchange" reRender="Datediscount_action" /> 
                                        </apex:inputcheckbox>
                                        <apex:outputlabel value="Enable the option of discount based on dates" for="Date discount" />

                                         </apex:pageblocksectionItem><br />
                                         <apex:pageblocksectionItem id="EFeepeoplediscount"> 
 
                                                <apex:inputcheckbox value="{!Eventfee_peoplediscount}" id="Eventfee_peoplediscount"/>
                                                <apex:outputlabel value="Enable the option of discount based on number of people" for="People discount" />

                                         </apex:pageblocksectionItem><br />                                         
                                         <apex:pageblocksectionItem id="EFeecoupondiscount"> 
 
                                                <apex:inputcheckbox value="{!Eventfee_coupondiscount}" id="Eventfee_coupondiscount"/>
                                                <apex:outputlabel value="Enable the option of discount based on coupons" for="coupon discount" />
                                        </apex:pageblocksectionItem><br /><br />
                                         <apex:pageblocksectionItem id="DateDiscount">
                                <apex:outputpanel id="Datediscount_action">
                                <apex:outputpanel rendered="{!Eventfee_datediscount == true}">
                                        <apex:outputlabel value="Discount based on dates" for="Date discount" /><br /><br />
                                        <apex:outputpanel id="datediscountblock">                                                                               
                                        <apex:dataTable columns="1" value="{!textValues}" var="item">
                                        <apex:column >
                                        <apex:inputText value="{!item.value}" />
                                        </apex:column>
                                         </apex:dataTable>
                                        <apex:commandButton action="{!addItem}" immediate="true" reRender="datediscountblock" value="Add new row"/>
                                </apex:outputpanel>
                                </apex:outputpanel>
                                </apex:outputpanel>
                                </apex:pageblocksectionItem>                                                
                                </apex:outputpanel>
                                </apex:outputpanel>
                                </apex:pageblocksectionItem>
                               
                                <apex:pageblocksectionItem >                              
                                <apex:commandButton value="Save" onclick="return IsValidate(this);"/>
                                </apex:pageblocksectionItem>
                        </apex:pageBlockSection>
                        <apex:pageBlockSection id="EventpriceinfoTest" title="Calendar test" columns="1" collapsible="false">
                       <apex:inputfield value="{!Eventinfo_startDT.Start_date_and_time__c}" id="Eventinfo_StartDTTest"/>
                                      
                       </apex:pageBlockSection>
                       
        </apex:pageblock>
        
  </apex:form>
</apex:page>

 

 

I hilightd the related code with big fonts please help me.

 

Thanks,

Naresh

 

MandyKoolMandyKool

Hi,

 

I have checked your code and it worked for me.

Have you checked for any javascript errors. It may happen that coz of javascript errors the calender is not loading.

This was selected as the best answer
naresh johnnaresh john

Excellent guess ! Thanks a lot for your help.

 

Really I spent many hours to resolve this problem. :(  

Really thanks a lot for your kind help. I removed the starting lines of JavaScript, now I am able to see calendar.

 

It worked great :)

 

Thanks,

Naresh