function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Olivia FordeOlivia Forde 

Can I hardcode a value into a picklist on Visualforce

On a Visualforce form I am using a rerender based on checkboxes and I want to set the Currency at this point also based on the checkbox - can this be done ?
James LoghryJames Loghry
You can specify a value on a picklist field that is not part of the picklist.  For instance, I can set Picklist__c = 'Apple' in Apex, but the Picklist__c is only set up with Orange and Banana.  If you use apex:outputField to display a picklist in Visualforce, you will only see the values in that picklist, however.  So apex:outputField would only display Orange and Banana.  Furthermore, if you're using the standard currency field, there's a bit of validation for valid, enabled currencies, so you could only set USD, EUR, etc on the currency field.

If you want to display other options, you could always generate your own list of select options in Apex, and then render it in a apex:selectList element in Visualforce. (See here: http://www.salesforce.com/docs/developer/pages/Content/pages_compref_selectList.htm)

I would suggest playing around with the "standard" picklist to see what you can come up with first and then if that doesn't work you may have to go the select list route.  Good luck!
Olivia FordeOlivia Forde
James
The apexOutput field should work as the item is form the list but I cannot get the syntax right 
This is the field 
{!MarketItems[BU].CurrencyISOCode}"