+ Start a Discussion

Has anyone written a component to reuse in force.com pages to enter dates for parameters?

Seems like someone would have written a component that could be reused for getting a date as an input field that has a date picker without having to always have an object date to use.


For instance, I want to have an input for a start date and and end date for a report or listing that has a date picker. Those dates could then be fed into a filter.. I am suggesting a component as it could be reused.




I mentioning the sample code for component you want


    <apex:attribute name="dummyObject" required="true" type="Contact" description="Dummy Object to be used for start and end date with date picker"/>
        Start Date
        <apex:inputField value="{!dummyObject.BirthDate}" />

 I have used "Contact" as dummy object and its field Birthdate in <apex:inputfield> tag to render a date picker for it. Please replace it with any other object having 2 date fields to render start and end date.


In case you don't have any such object, pass two dummy object in <apex:attribute> for start date and end date.


Mentioning page and class code also:


<apex:page controller="TestPageController ">
      <c:DateComponent dummyObject="{!dummyObject}" />

public class TestPageController {

    public Contact dummyObject {get; set;}
    public TestPageController () {
        dummyObject = new Contact();