You need to sign in to do that
Don't have an account?
mikef
Issue with a pick list in VF
Hi:
I can't get my set method to fire when I have a selectList VF tag.
When viewing the system log window the debug comes up null, and the value of the selectList doesn't populate back to sfdc.
I have other fields on the record that I populate and their are working fine.
I can't get my set method to fire when I have a selectList VF tag.
Code:
<!-- page code --> <apex:selectList id="chooseRole" value="{!partnerRoleValue}" size="1"> <apex:selectOption itemValue="Source Lead" itemLabel="Source Lead"/> <apex:selectOption itemValue="Joint Sales" itemLabel="Joint Sales"/> <apex:selectOption itemValue="Reseller" itemLabel="Reseller"/> <apex:selectOption itemValue="Referral" itemLabel="Referral"/> <apex:selectOption itemValue="Technology" itemLabel="Technology"/> </apex:selectList>
Code:
/**controller code**/ public String getPartnerRoleValue() { return partnerRoleValue; } public void setPartnerRoleValue(String parterRoleValues) { this.partnerRoleValue = partnerRoleValue; System.debug('test partner value ' + getPartnerRoleValue()); }
When viewing the system log window the debug comes up null, and the value of the selectList doesn't populate back to sfdc.
I have other fields on the record that I populate and their are working fine.
Jill
I looked at your code and the only thing that was different is the form tag.
So I copy and pasted your code in my page and the system.debug sill comes up null.
Could this be an org setting?
Would you mind posting your whole page and controller? Or if not could you shrink it down to something I can fully copy and paste into my test org?
Jill
Thank you I thought this.partnerRoleValue would reference the class's variable.
Message Edited by mikef on 04-01-2008 05:37 PM
Whether you are trying to actually create a partner or just want to leverage the values from that field doesn't really matter but you might get value from actually leveraging the field itself through inputFIeld so it's values are managed dynamically from the field definition under setup.
To do this you just need to construct a dummy partner object. Here's an example:
Note: You can also dynamically manage your picklist options in code using the selectOption type and selectOptions component. There was a recent write up on that on the blog with an accompanying page on the wiki.
Thank you this is exactly what I want todo.
Now I need to write back to salesforce the selection the user picked.
In my controller I have a method that saves an Opportunity record with values the user picked along the way.
I need to populate my partnerRoleValue variable.
How do I do that with the inputField?
And is there a better way?
Thanks Andrew.