You need to sign in to do that
Don't have an account?
Getting the selected value of a picklist
Hi, I need help retrieving the option the user selected of a pre-determine values of a picklist I created. So my other indepedent picklist retrieves the value depending on the user first selection.
Thanks for all the Help you can give.
Here's the Code:
Controller Code:
Public string select1{get; set;}
Public string select2{get; set;}
public List<SelectOption> getItems()
{
List<SelectOption> option = new List<SelectOption>(option);
option.add(new SelectOption('Modem1','Celulares'));
option.add(new SelectOption('Modem2','Dmax'));
option.add(new SelectOption('Modem3','ATM'));
option.add(new SelectOption('Modem4','VOIP'));
option.add(new SelectOption('Modem5','Modem5'));
return option;
}
public List<SelectOption> getItems2()
{
List<SelectOption> options = new List<SelectOption>();
if( theValueimsearchingfor = 'VOIP){
List<Product2> proList = [select name from Product2 where ProductCode like '0001-%'];
for(product2 a : proList)
options.add(new SelectOption(a.Name,a.Name));
}
return options;
}
Apex Code:
<apex:selectList id="picklist1" title="Tipo" id="selectlist1" value="{!select1}" size="1">
<apex:actionSupport event="onclick" reRender="selectlist2"/>
<apex:selectOptions value="{!items}"/>
</apex:selectList>
<apex:selectList title="Marca" id="selectlist2" value="{!select2}" size="1">
<apex:actionSupport event="onclick" reRender="selectlist3"/>
<apex:selectOptions value="{!items2}"/>
</apex:selectList>
xzuvel,
you can use the select1 as a variable in your controller, which automatically holds the user selected value in it.
Ex: if user selected "Modem2", select1 value would be "Dmax"
In your items2 property, you can refer it as
if(select1 == 'DMAX')
{your operations}
Thanks,
All Answers
xzuvel,
you can use the select1 as a variable in your controller, which automatically holds the user selected value in it.
Ex: if user selected "Modem2", select1 value would be "Dmax"
In your items2 property, you can refer it as
if(select1 == 'DMAX')
{your operations}
Thanks,
Thanks for the information : D