Assign inputfield value to date variable in controller
Hi all
I am displaying datepicker through following code
controller:
Task t = new Task(); public Date selecteddate = t.activitydate; public Task getTask() { return t; }
page:
<apex:inputField value="{!task.activitydate}"/>
I am using it for inserting event to selected date. Here user can select date and insert event for that date.
How to get user selected date to controller from datepicker generated by above code ????
It is sObject binding. i want to to get date which is selected by user through this code and i want to use that date to add event. So is there any way to fetch date from sObject with above code and pass it as in simple Date format for creating event.
Please give some suggestions, if possible then suggest code sample to have an idea.
You need to use standardController functionality. In your
constructor place the following code :
Task t=(Task)controller.getRecord();
The above method returns the all data for those fields
which is binded using apex:inputField in the page. Now you can access selected
activity date from t.activitydate.
You need to use standardController functionality. In your constructor place the following code :
Task t=(Task)controller.getRecord();
The above method returns the all data for those fields which is binded using apex:inputField in the page. Now you can access selected activity date from t.activitydate.
Thanks for your valuable reply.