I am attempting to capture a date input from a VF page and then passing it onto a newly created record. All I want to do is bring up the VF page with a custom button in one object (objectA) and use it as a means of input for creating a record in another object (objectB). I am using what would be a blank Date field from objectA as the means for input for the date. I then just want to capture that input in a controller and pass it into a field of the newly created record (objectB). I don't want to save the value of the input into the objectA.
I am doing this in order to get a proper looking data picker in the VF page.
Here is my current VF page :
<apex:pageBlockSectionItem >
<apex:inputfield id="theDateInput" value="{!objbvar.Document_Date__c}" required="false"/>
</apex:pageBlockSectionItem>
And I am attempting to pass that input into a field for a newly created record with this controller :
public class UploadControllerVendorProdRev {
public Date thedateinput {get;set;}
private objectA__c parent {get;set;}
public objectB__c objbvar{get;set}
public UploadControllerVendorProdRev(ApexPages.StandardController controller) {
this.parent = (ObjectA__c)controller.getRecord();
}
private Database.SaveResult saveCustomAttachment() {
ObjectB__c obj = new ObjectB__c();
obj.Parent __c = parent.Id;
obj.Document_Date__c = thedateinput ;
return Database.insert(obj);
}
As it is now I am not capturing a value. I am only creating the ObjectB record with a blank Document_Date__c field.
I wanted to include the <***NOT USING THIS line just to show what I originally was doing with this before I decided to use an inputfield from ObjectA as a means to have user input, even though I am not saving that input to ObjectA, only trying to pass it onto the new ObjectB record.
Thank you very much for any help.