1
 <apex:selectRadio  id="Frequency" layout="pageDirection" value="{!frequency}"
                                      onChange="show(this.value)">
                        <apex:selectOption itemValue="Daily" itemLabel="Daily"></apex:selectOption>
                        <apex:selectOption itemValue="Weekly" itemLabel="Weekly"></apex:selectOption>
                        <apex:selectOption itemValue="Monthly" itemLabel="Monthly"></apex:selectOption>
                        <apex:selectOption itemValue="Yearly" itemLabel="Yearly"></apex:selectOption>
                    </apex:selectRadio>

here is the controller code

     public String frequency { get; set; }

     System.debug(frequency);

how can I get the value of frequency as selected on the list and whenever the selection is changed then frequency variable also updates in the controller? thanks a lot for the help

2

Try actionfunction or actionSupport

VF:

<apex:actionFunction action="{!MyMethod}" name="myFunction" />

<apex:selectRadio id="Frequency" layout="pageDirection" value="{!frequency}" 
    onChange="myFunction()">

Or:

    <apex:actionSupport event="onchange" action="{!MyMethod}" />
</apex:selectRadio>

Apex:

public void MyMethod(){
    System.debug(frequency);
}   

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.