+ Start a Discussion
lvivaninlvivanin 

inputDate like inputText component

I need to get user input as a date value in visualforce page. I can use inputText component for that - in which case user has to manually write the date. But I am looking for a way to give user to pick date from the calander (like in standard salseforce). Can we do it outside of the Salesforce object?

 

Any thoughts ..

Venkat PolisettVenkat Polisett

You cannot do that outside of an sobject.

 

Example:

 

public class Test { public Contact TempContact {get;private set;} public Test { // create a temp sobject instance TempContact = new Contact(); } public PageReference Save() { // use Temp Contac's birhdate to your liking Date myDate = TempContact.Birthdate; } } // page <apex:page controller="Test"> <apex:pageBlock> <apex:pageBlockSection> <apex:pageBlockSectionItem> <apex:outputLabel for="myDate" value="Please enter a date" /> <apex:inputField id="myDate" value="{!TempContact.Birthdate}" required="true"/> </apex:pageBlockSectionItem> </apex:pageBlockSection> </apex:pageBlock> </apex:page>

 

Hope this helps.

lvivaninlvivanin

Thank you Venkat,

 

Actually I am trying to do outside of salesforce object -  as a part of search criteria.

XactiumBenXactiumBen

Vote for my idea to get this functionality into Visualforce - http://ideas.salesforce.com/article/show/10098124/Create_date_fields_in_visualforce_without_salesforce_object

Message Edited by XactiumBen on 09-16-2009 10:18 AM