You need to sign in to do that
Don't have an account?
Jyosi jyosi
Radio Button Selection values into Apex Class
Hello Everyone,
I have a pageblock section
<apex:pageBlockSectionItem id="producttypesectionitem" >
<apex:outputText value="Product Type" />
<apex:selectRadio id="producttypeoptions" layout="pageDirection" value="{!ProductTypeOptions}" onclick="myFunction(this);">
<apex:selectOptions id="producttypeitem" value="{!ProductTypeItems}" />
<!--<apex:selectOptions value="{!items}"/>-->
</apex:selectRadio>
</apex:pageBlockSectionItem>
In Apex class i am using below code I need to get the values of XX and YY based on selection of radio buttion from user in apex class
Like if they select X i need to run one query else i need to run other query .
public String getProductTypeOptions(){
return ProductTypeOptions;
}
public void setProductTypeOptions(String ProductTypeOptions){
this.ProductTypeOptions = ProductTypeOptions;
}
public List<SelectOption> getProductTypeItems() {
List<SelectOption> options = new List<SelectOption>();
options.add(new SelectOption('XX','XX'));
options.add(new SelectOption('YY','YY'));
return options;
}
please help me out i am not able to get the values selected on radio button.
Thanks for help.
Regards,
Jyo
I have a pageblock section
<apex:pageBlockSectionItem id="producttypesectionitem" >
<apex:outputText value="Product Type" />
<apex:selectRadio id="producttypeoptions" layout="pageDirection" value="{!ProductTypeOptions}" onclick="myFunction(this);">
<apex:selectOptions id="producttypeitem" value="{!ProductTypeItems}" />
<!--<apex:selectOptions value="{!items}"/>-->
</apex:selectRadio>
</apex:pageBlockSectionItem>
In Apex class i am using below code I need to get the values of XX and YY based on selection of radio buttion from user in apex class
Like if they select X i need to run one query else i need to run other query .
public String getProductTypeOptions(){
return ProductTypeOptions;
}
public void setProductTypeOptions(String ProductTypeOptions){
this.ProductTypeOptions = ProductTypeOptions;
}
public List<SelectOption> getProductTypeItems() {
List<SelectOption> options = new List<SelectOption>();
options.add(new SelectOption('XX','XX'));
options.add(new SelectOption('YY','YY'));
return options;
}
please help me out i am not able to get the values selected on radio button.
Thanks for help.
Regards,
Jyo
Can you put a debug statement in your controller and see what the variable is printing.
You can also use the below shorthand, if there is no logic inside the getter and setter methods.
Controller
-------------------
If you execute this code you can see that in logs country is printing value.
Hope this helps you.
Please accept my solution as Best Answer if my answer was helpful. It will make it available for other as the proper solution. If you felt I went above and beyond, you can give me kudos.
Thanks and Regards
Sandhya