You need to sign in to do that
Don't have an account?
i have one Radio button.if i select that radio button(itemlabel) corrosponded itemvalue should display on page..can any one help me
vf page:
<apex:page controller="radiobox_Class">
<apex:form>
<apex:pageBlock>
<apex:pageBlockSection >
<apex:selectRadio label="Select Hobby" borderVisible="true" immediate="true" disabled="false" value="{!SelectGame}">
<apex:selectOption itemlabel="FootBall" itemvalue="FB"/>
<apex:selectOption itemlabel="Tennis" itemvalue="TN"/>
<apex:selectOption itemlabel="Hockey" itemvalue="HOC"/>
<apex:selectOption itemlabel="CoCo" itemvalue="Co"/>
<apex:selectOption itemlabel="Cricket" itemvalue="Cric"/>
</apex:selectRadio>
<apex:commandButton value="Show Selected game" action="{!Display}"/>
<apex:outputLabel>your selected game code is....{!output }</apex:outputLabel>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
class:
public class radiobox_class {
public string output{get;set;}
public string SelectGame{get;set;}
public void Display(){
if(SelectGame=='FootBall'){
output='FB';
}else if(SelectGame=='Tennis'){
output='TN';
}else if(SelectGame=='Hockey'){
output='HOC';
}else if(SelectGame=='Cricket'){
output='CIC';
}else if(SelectGame=='CoCo'){
output='Co';
}else{
output='sorry some thing went wrong';
}
}
}
i want through method only
THanks in Advance
<apex:page controller="radiobox_Class">
<apex:form>
<apex:pageBlock>
<apex:pageBlockSection >
<apex:selectRadio label="Select Hobby" borderVisible="true" immediate="true" disabled="false" value="{!SelectGame}">
<apex:selectOption itemlabel="FootBall" itemvalue="FB"/>
<apex:selectOption itemlabel="Tennis" itemvalue="TN"/>
<apex:selectOption itemlabel="Hockey" itemvalue="HOC"/>
<apex:selectOption itemlabel="CoCo" itemvalue="Co"/>
<apex:selectOption itemlabel="Cricket" itemvalue="Cric"/>
</apex:selectRadio>
<apex:commandButton value="Show Selected game" action="{!Display}"/>
<apex:outputLabel>your selected game code is....{!output }</apex:outputLabel>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
class:
public class radiobox_class {
public string output{get;set;}
public string SelectGame{get;set;}
public void Display(){
if(SelectGame=='FootBall'){
output='FB';
}else if(SelectGame=='Tennis'){
output='TN';
}else if(SelectGame=='Hockey'){
output='HOC';
}else if(SelectGame=='Cricket'){
output='CIC';
}else if(SelectGame=='CoCo'){
output='Co';
}else{
output='sorry some thing went wrong';
}
}
}
i want through method only
THanks in Advance
Try this:
Hope this helps!
Best Regards,
Sourav