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
VarunCVarunC 

Date Input option

Hi,

I need to provide a custom filtering option, I'm developing a VF page where I've a textbox for searching contacts, now, I want to re-defin the interface where I need to provide an Input Box with an associated calendar control to pick DATE, and then on search I need to pass on the selected date value to the query so that filtered records are defined on the entered parameters.

How can I place a simple HTML textbox and a popup calendar to select date and then Use the selected value and have the value used in Controller Class for filtering records?

Can we use jQuery calendar plugins etc here in VisualForce page ?


Best Answer chosen by Admin (Salesforce Developers) 
TehNrdTehNrd
Or you could use the saleforce.com date picker:

Code:
public Opportunity opp {get; set;}

List<Contact> cons = select Id, FirstName where CreatedDate > :opp.CloseDate];

<apex:inputField value="{!opp.closeDate}"/>

 

All Answers

TehNrdTehNrd
Or you could use the saleforce.com date picker:

Code:
public Opportunity opp {get; set;}

List<Contact> cons = select Id, FirstName where CreatedDate > :opp.CloseDate];

<apex:inputField value="{!opp.closeDate}"/>

 

This was selected as the best answer
VarunCVarunC
No, you got it wrong, I meant to use the field as SEARCH section, I mean, there is a textbox that is used to search any contact, now I want a Date Picker side-by-side of this search textbox to select date, which will allow me to filter result like, [Select Id From Contact Where name Like '%xxxxx%' And CreateDate>FilterDate]

And I need to know how can I have a Datepicker Control THAT IS NOT DATABOUND, i know, if I databound a field in salesforce, it will automatically convert the text field to datepick control, but this Datepick control i need is to be Stand alone, that needs to select date, and pass the value to APEX class.
jwetzlerjwetzler
There is not currently an input component that generates the standard date picker.  The only way to get the date picker (besides rolling your own, which I see you're trying to do) is to use inputField bound to a date field.  What TehNrd was showing you is correct and is basically a "workaround" for being able to use the date picker functionality.  You basically use some throwaway object, in this case an opportunity, that has a date field on it, and bind your input field to a new opportunity's closeDate.  Then you can use that field to do your query, as it holds your date information, and you can even save it off to your own date field if you want.

I think this is a much easier solution to get what you need rather than trying to roll your own javascript date picker.
VarunCVarunC
Hi, I got it sorted out :) ...

here is the Solution i created for implementing date picker:
http://wiki.apexdevnet.com/index.php/Code_Samples#jQuery_DatePicker_Component_for_Selecting_Date_in_VisualForce_Page - http://wiki.apexdevnet.com/index.php/Code_Samples#jQuery_DatePicker_Component_for_Selecting_Date_in_VisualForce_Page

Here i've created and used jQuery to create a Custom Component for DatePicker on VisualForce Page :)
TehNrdTehNrd
I know jQuery is a popular js library and will probably always work across many browsers but I will always stick with standard sfdc functionality whenever possible.




Message Edited by TehNrd on 12-03-2008 09:04 AM
elghoul_girlelghoul_girl

Hello,

 

    I am using the datepicker of the jquery as well but I want to know how to use the selected date value to pass it to my controlelr. Please help.

 

Thanks,

    Sally