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
Cable Guy.ax375Cable Guy.ax375 

Parsing dropdown element and pass value to hidden field

I have a dropdown on Visual Force page with the options look like the following:

 

January -- FY 2010

February -- FY 2010

March -- FY 2010

April -- FY 2010

......

......

 

On the visual force page, how should I parse the selected option to pass them to two hidden fields: hiddenMonth, hiddenYear so that hiddenMonth will have value of month and hiddenYear will have value of year?

 

Any help will be greatly appreciated.

Best Answer chosen by Admin (Salesforce Developers) 
SargeSarge

Hi,

 

   Use String.spilt('--') function in apex to split the selected picklist value in controller. The result will be arrary of "January" and "FY 2010" (like ['January','FY 2010']. you can then use this array to set hidden variables in apex.