You need to sign in to do that
Don't have an account?
Royal
how to get standard date picker custom VF ?
Hi All,
In custom VF page have to display date fields with date picker, how can i write code for this ?
there is no standard controller, on custom controller is there for page.
Thanks
In custom VF page have to display date fields with date picker, how can i write code for this ?
there is no standard controller, on custom controller is there for page.
Thanks
Salesforce has a standard vf component called <apex:input> which can help you for this recuirement.
this has type attribute to accept date.
Ex:
Hope this helped you... :)
For eg:., if you field is Date/DateTime it will automatically render the date calendar. For relationship fields, it automatically renders to a lookup field.
Let me know if this helped.
Please find the below examples to display the date field with date pickers.
Ex 1 :
Visual Force Page :
<apex:page docType="html-5.0" controller="Sample">
<apex:form >
<apex:pageBlock >
<apex:pageBlockSection>
<apex:pageBlockSectionItem>
Date: <apex:input type="date" value="{!dat}"/>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
Apex Controller :
public class Sample {
public Date dat {get;set;}
public Sample() {
}
}
Ex 2 :
Visual Force Page :
<apex:page controller="datePicker" id="mypage">
<apex:form>
Date: <apex:inputText value="{!datename}" size="10" id="demo" onfocus="DatePicker.pickDate(false, this , false);" />
</apex:form>
</apex:page>
Apex Controller :
public class DatePicker
{
public String datename {get; set;}
}
Note : Before executing the above code check with your visual force page vesion, and set it to 27 - 28 in order for DatePicker to work.
Please mark my solution as best answer if it helps you................
Best Regards,
Nagendra.P
Date: <apex:input type="date" value="{!dat}"/> ------ is not working for IE, Mozila browser.
<apex:inputText value="{!datename}" size="10" id="demo" onfocus="DatePicker.pickDate(false, this , false);" /> ---- is not working for VF page version 37
any other way to acive this ? like by using javascript or Jquery etc...
Thanks
use below code:
String sDate = String.ValueOf('DATEGETBYACTIONSUPPORT or DATEGETBYACTIONFUNCTION');
System.Debug('sDate: ' + sDate);