+ Start a Discussion
Sandeep M 1Sandeep M 1 

Bind datepicker value from visualforce page to controller

How to bind the datepicker value to controller. I used onfocus="DatePicker.pickDate" but it was not displaying datepicker in sandbox so i am using as below. 


<apex:page standardController="SFDC_Employee__c" extensions="payslipext" sidebar="true" showheader="true">
<apex:form >
<apex:pageBlock >
<apex:pageBlockSection >
<apex:inputField value="{!SFDC_Employee__c.Month__c}"/>

</apex:pageBlockSection>
<apex:outputLink value="PaySlipPage" id="page">Generate
<apex:param value="{!dateName}" /></apex:outputlink>
</apex:pageBlock>
</apex:form>

</apex:page>

could any one tell me how to bind inputField value="{!SFDC_Employee__c.Month__c} in controller when Outputlink 'Generate' is clicked
AshwaniAshwani
Best way to find a date type variable is use <apex:inputfeld> or <apex:inputdate>

If anyway you can't use above expression then beat way is bind the date expression with String type and use Date.parse method. Alternatively you can create date by Date.newInstance(..) metohds.

date.parse('09-05-2014');

 
Avidev9Avidev9
So why not create object of SFDC_Employee__c in your extention and use that as bind variable ?
You can refer to that variable to capture value in the controller