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
calvin_nrcalvin_nr 

How to: Input Date field on Visualforce page with custom controller

Hey guys,

 

I know that currently in visualforce, as a workaround we can use an input date field by binding it to a date field from an unused object instance.

 

Currently I have a visualforce page with a custom controller.

<apex:page controller="FundingReportController" sidebar="false" showheader="false" standardstylesheets="true">

 I want to display two date fields here which show the date picker. I want to be able to be able to use the date fields from a custom object called money transactions.

 

<apex:form>
           <table id="searchTable" cellpadding="2" cellspacing="2">
               <tr>
                    <td style="font-weight:bold;">From Date:<br/>     
                    <apex:inputField value="{!mt.closeDate}"/>  

 I am getting this error.

 Error: Unknown property 'FundingReportController.mt'

How do I declare the Money transactions object mt in this case since the contoller is a custom one and is required. Any other way I can declare the custom object I need so I can reference the fields I need in this form?

 

 

Best Answer chosen by Admin (Salesforce Developers) 
SFDC_EvolveSFDC_Evolve

I think .. Declaring the object of the Money transactions  in the FundingReportController would solve the issue....

 

Mark this as a solution . If this solves the issue . . 

 

Thanks 

SFDC Evolve

 

All Answers

SFDC_EvolveSFDC_Evolve

I think .. Declaring the object of the Money transactions  in the FundingReportController would solve the issue....

 

Mark this as a solution . If this solves the issue . . 

 

Thanks 

SFDC Evolve

 

This was selected as the best answer
calvin_nrcalvin_nr

Thanks that was the answer for my problem. Marking as solution.

 

But I was disapponted to see the solution  for the date inout field given here(http://boards.developerforce.com/t5/Visualforce-Development/Date-Input-option/td-p/100224) does not work anymore.

I did not see a date picklist or field. This now just displays a static date value.

 

 

I am curious to know what you folks are using for date input fields since I guess this workaround does not work anymore.

Prajwala chPrajwala ch
<apex:page controller="FundingReportController" sidebar="false" showheader="false" standardstylesheets="true" docType="HTML-5.0">
<apex:form>
           <table id="searchTable" cellpadding="2" cellspacing="2">
               <tr>
                    <td style="font-weight:bold;">From Date:<br/>     
                    <apex:input value="{!mt.closeDate}" type="date"/>
See if this works.