You need to sign in to do that
Don't have an account?
Anu Raj.ax1269
Not able to get the value.
Hi
I am trying to to create the VF page where I select the value and trying to get the value into controller. But I am not able to get the value my code:
<apex:page controller="SearchAndSendCtrl"> <apex:form > <apex:pageBlock title="Seerch And Send Email"> <apex:pageBlockSection > <apex:inputField value="{!ws.Worker_Name__c}"/> <apex:inputField value="{!ws.Work_Date_Time__c}"/> </apex:pageBlockSection> <apex:pageBlockButtons > <apex:commandButton value="Search" action="{!searchAction}"/> <apex:commandButton value="Send Email"/> </apex:pageBlockButtons> </apex:pageBlock> </apex:form> </apex:page>
public class SearchAndSendCtrl { // Worker_details__c wd = new Worker_details__c(); public Worker_details__c wd {get;set;} public Work_Status__c ws {get; set;} public SearchAndSendCtrl(){ } public PageReference searchAction() { system.debug('Result of Name : ' + ws); system.debug('Result of Date : ' + ws); return null; } }
Please help me solve this issue. Please tell me what is need to be changed in this code.
Thanks
Anu
Hi,
The problem is that there is not value being passed into controller. The method "SearchAction" is not really doing anything either.
Were you able to get results in your debug log?
They are being passed in due to the value being set in the input field (if this were input text, he would need to use an assignto option). However, he is trying to debug the object and not the field on the object.
Try something like this in your debug:
Also, in your constructor you need to initalize your object like this:
ws = new Work_Status__c();