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
jedi_101jedi_101 

how to get a datetime input?

I am a newbie giving this a test drive...

i am writing a small app that pulls leads created between two input dates

so i need to prompt the user for a begin date and an end date and pull the number of leads created between those dates.

how do i do this?  inputField doesn't seem to be the answer...inputText doesn't prompt with a calendar widget..please don't tell me i need to write my own javascript to show a calendar!
mtbclimbermtbclimber
Right now the only way to get the standard SFDC date input element is to use inputField.

Don't be afraid, however, you need not write your own you just need to establish a record with a date input value on it.

The easiest thing to do is probably to leverage the Task or Event sobjects depending on whether you need a date or datetime.

Let's say you use task. In your controller you would do something like this...



Code:
public mycontroller {

  Task t = new Task();

  public Task getTask() { return t; }

  public pagereference myaction() {
     Date d = t.activitydate;
  }

}

 
Now in your page just bind inputField to the task activity date:

Code:
<apex:inputField value="{!task.activityDate}"/>

 

jedi_101jedi_101
quick response, elegant solution. awesome!  thanks.