You need to sign in to do that
Don't have an account?
randheer practise
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
All Answers
Try this:
Hope this helps!
Best Regards,
Sourav
It seems like you're trying to implement a Visualforce page with radio buttons to display corresponding values. Your code looks correct, but you're encountering an issue. To help you out, could you please specify the exact problem you're facing or any error messages you're receiving? This will make it easier to provide you with a solution.For more visit : https://futbollibreenvivo.org/