You need to sign in to do that
Don't have an account?
Problems capturing date value using input field on Visual Force Page
I have been experiencing difficulty using an inputfield to capture a date value on a visualforce page. The code code I am using is:
<apex:pageBlockSectionItem >
<apex:outputLabel >When is the new account required by? </apex:outputLabel>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:inputField required="true" value="{!NewForm.Date_Needed__c}"/>
</apex:pageBlockSectionItem>
these pageBlockSectionItems are properly nested inside a pageblocksection, and a page block. The page is not throwing any errors, but the value is not being captured.
What is interesting is I am using the same code in a different component for another form and it is working just fine their. The value for Date_Needed__c is not being touched by the controller for the page in either instance. Therefore they are nearly identical, but for some reason this particular form will not accept the date selected by the user. The calender widget does appear however, and visually it appears the date is being captured. It just does not come through in the record being created.
Any help would be greatly appreciated, this is the only broken piece of my app and I am just trying to fix this before final deployment.
This issue was solved by removing the second NewForm declaration from my getNewForm method, silly mistake that caused a lot of trouble!!!
All Answers
Are you using a controller? Can you post that code?
That is the controller for the form which I am trying to capture a date value with. As you can see I am not touching the value for Date_Needed__c here at all.
Can you post the VF code? Are you using showHeader="false" ? Are you using controller or extension?
First of all, thanks again to everyone trying to help. I have tried so hard to understand what is going wrong here, any help is so appreciated!
Second I am using collapsible = false, also I just checked my debug logs and just before the actual saveAARF method is called the value of date_needed__c is null, even though I have selected a date.
08:54:53.100 (100874000)|SYSTEM_METHOD_ENTRY|[64]|System.debug(ANY)
08:54:53.100 (100939000)|USER_DEBUG|[64]|DEBUG|Date needed = null
08:54:53.100 (100971000)|SYSTEM_METHOD_EXIT|[64]|System.debug(ANY)
08:54:53.101 (101080000)|DML_BEGIN|[67]|Op:Insert|Type:Form__c|Rows:1
Finally, This is the contents of the visual force page:
This is the component that sits on that page:
This issue was solved by removing the second NewForm declaration from my getNewForm method, silly mistake that caused a lot of trouble!!!