You need to sign in to do that
Don't have an account?
Michael Sypro
retrieve value of inputField
I think this is a pretty basic question, but it's beating me right now. I have a list of leads in a pageBlockTable with an inputField for the user to set a new value for the field Follow_up_Date__c.
Visualforce:
I need help at the question mark line. How do I get the value from the inputField and save the lead?
Thanks
Visualforce:
<apex:inputField id="txtFDate" value="{!cc.Follow_up_Date__c}" /> <apex:commandLink value="Update" action="{!saveFollowUp}" rerender="leadBlock" > <apex:param name="leadId" value="{!cc.Id}" /> </apex:commandLink>Apex:
public PageReference saveFollowUp(){ string leadId=ApexPages.currentPage().getParameters().get('leadId'); date fDateToUse=?????; if (leadId!=null) { Lead leadToUse = [select id from lead where id=:leadId limit 1]; leadToUse.Follow_up_Date__c=fDateToUse; update leadToUse; } return null; }
I need help at the question mark line. How do I get the value from the inputField and save the lead?
Thanks
Here's the results:
The inputField automatically saves to the lead list l. I just needed to make l a getter/setter and loop through it to get the results.
All Answers
What is 'cc'? If that is a controller variable and has a public setter, this should work,
Is there no way to pull the inputField by its id or save the current value to a param of its own using javascript? That makes the most sense to me. Is the controller method the way to go?
Create a map and populate it while you query lead records. Use it in your save method to get the followup date,
I have assumed that leads is a variable in your controller and has a public setter. Also I have assumed that your pageblock table is withing one apex:form tag.
Here's the results:
The inputField automatically saves to the lead list l. I just needed to make l a getter/setter and loop through it to get the results.