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

Radiobutton checked events.


I have two radio buttons in a select radio and also two out panels.



<apex:form >

<apex:selectRadio id="ScheduleTime" value="{!string}">
 <apex:selectOption itemValue="Immediate" itemLabel="Immediate"/>
<apex:selectOption itemValue="Later" itemLabel="Later"/>

<apex:outputPanel id="Immediately" >
<apex:inputText id="text1" ></apex:inputText>
<apex:outputPanel id="Later">

</apex:form >




   String s = 'Immediate';
public String getString() {
return s;
public void setString(String s) {
this.s = s;


How can i make a panel visible when a radio button is checked and other invisible and also use the components in the panels.Do i need to use any script .Please help me out .......





     Use actionsupport component and rendered attribute in outputpanel


Sample code:

Page: <apex:page controller="test"> <apex:form> <apex:selectRadio value="{!country}"> <apex:selectOptions value="{!items}"/> <apex:actionsupport event="onclick" rerender="out" action="{!onclickaction}"/> </apex:selectRadio><p/> </apex:form> <apex:outputPanel id="out" > <apex:actionstatus id="status" startText="testing..."> <apex:facet name="stop"> <apex:outputPanel rendered="{!flag}" id="out1"> <p>You have selected:</p> <apex:outputText value="{!country}"/> </apex:outputPanel> </apex:facet> </apex:actionstatus> </apex:outputPanel> </apex:page> Controller: public class test{ String country = null; boolean flag=false; public boolean getflag() { return flag; } public void onclickaction() { if(country=='US') flag=true; else flag=false; } public List<SelectOption> getItems() { List<SelectOption> options = new List<SelectOption>(); options.add(new SelectOption('US','US')); options.add(new SelectOption('CANADA','Canada')); options.add(new SelectOption('MEXICO','Mexico')); return options; } public String getCountry() { return country; } public void setCountry(String country) { = country; } }



Thanks alot sir,

  you saved my time   :)