Friday, August 2, 2013

Standard Salesforce DatePicker not working?

Some times Visualforce page with rerender sections, that standard DatePicker field based on Date or DateTime inputField tag was not working?

This was happend to me recently when I am developing some vf page. For this, a small hack that we can use is

if you have any field which is date or datetime, try to create the block which executes on every load with out and conditional renderings . This will allow to initialize the script and works for our custom inputField in vf page..

<div style=”display:none”>
    <apex:inputField value=“{!Account.Date_field__c}”/>
</div>


if you don't have any field which is date or datetime on the standard controller then create a property for the extension if you have any(if not you may need to created a date field on the standard controlller..but this doesn't make sense...in order to cover an issue we are not supposed to create  field..) which contains a set up object date or datetime field and make use of the same. like

public opportunity oppObj {get;set;}

<apex:inputField value="{!oppObj.closeddate}" rendered="false"/>

Hope this will help those we stuck with this kind of issue...Thank you.

No comments:

Post a Comment