+ Start a Discussion
HeenaHeena 

Standard data time picker for custom fields in visualforce page

Hi,

I am developing a visualforce page with a custom controller and have some custom search filters on it .

 

There are few date filters and i want to have the standard salesforce date time picker poping up when the field goes on focus(). Right now i am using a custom built datatime picker, but the picker is out of sink with salesforce wiht respect to the look and feel.

I have seen that the salesforce picker appears for standard fields but the date fields in my page are not mapped to any object and hence i am not sure if i can get the salesforce standard picker.

 

Please help.

 

Thanks & Regards,

Heena

Best Answer chosen by Admin (Salesforce Developers) 
HeenaHeena

 Thanks Aalbert,

 

I was trying to replicate the reminder datetime field of task

 

and my trouble is if i use an inputfield tag like <apex:inputField value="{!task.ReminderDateTime}"/>

 

Instead of having seperate fields for date and time it shows me one field now here the user has to manually enter the time, not user friendly (unlike chosing from a drop down in standard page)

 

And if i use any other date field as input field i always get the link of current date which i do not require.

 

Please help

 

Thanks,

Heena

All Answers

aalbertaalbert

Yes, you can accomplish this by mapping your search filter field which is a date/datetime data type to a date/datetime field in SFDC. I understand that the field doesn't necessarily map to any object/custom field in your salesforce.com schema, but you can use it in your custom controller to at least inherit the data type in an inputField VF component.

 

So for example, in your controller, create another public property such an Opportunity.

 

public Account tempOppty {get;set;}

 

 Then in your VF page, in your search filter area, reference the tempOppty property.

 

<apex:inputField value="{!tempOppty.CloseDate}" />

 

 

 

And when the user performs the "Search" action, you can get the entered value from the tempOppty object in the controller.

 

 

HeenaHeena

 Thanks Aalbert,

 

I was trying to replicate the reminder datetime field of task

 

and my trouble is if i use an inputfield tag like <apex:inputField value="{!task.ReminderDateTime}"/>

 

Instead of having seperate fields for date and time it shows me one field now here the user has to manually enter the time, not user friendly (unlike chosing from a drop down in standard page)

 

And if i use any other date field as input field i always get the link of current date which i do not require.

 

Please help

 

Thanks,

Heena

This was selected as the best answer
VFVF

Hi Heena,

Mee too working on this for few days , according to the examples and from developers guide i came to know that we have datetime pickers only for standard controllers.If you get any information regarding this please let me know...

 

shaan:smileyhappy: