0

I have two radio buttons Yes or No in VF page. based on User profile I have to shoe the buttons. For suppose if the profile is a Director level display both "Yes" and "No".Lowe than Director profile, display only "Yes"..

<apex:slecectRadio value="{!ProceedWithPlan}" Id= '''proceedWithPlanId" rendered =""{!isProfileAboveDirector}'>
<apex:selectoption itemLabel ="Yes" itemvalue="yes" id="yesid">
</apex:selectoption>
<apex:selectoption itemLabel ="No" itemvalue="No" id="noId">
</apex:selectoption>.
</apex:slecectRadio>

<apex:slecectRadio value="{!ProceedWithPlan}" Id= '''proceedWithPlanId" rendered =""{!NOT(isProfileAboveDirector)}'>
<apex:selectoption itemLabel ="Yes" itemvalue="yes" id="yesid">
</apex:selectoption>
</apex:slecectRadio>

Error :Duplicate Id..Plz help me with this..

1
  • <apex:slecectRadio value="{!ProceedWithPlan}" Id= '''proceedWithPlanId" rendered =""{!isProfileAboveDirector}'> <apex:selectoption itemLabel ="Yes" itemvalue="yes" id="yesid"> </apex:selectoption> <apex:selectoption itemLabel ="No" itemvalue="No" id="noId"> </apex:selectoption>. </apex:slecectRadio> <apex:slecectRadio value="{!ProceedWithPlan}" Id= '''proceedWithPlanId" rendered =""{!NOT(isProfileAboveDirector)}'> <apex:selectoption itemLabel ="Yes" itemvalue="yes" id="yesid"> </apex:selectoption> </apex:slecectRadio> Error :Duplicate Id..Plz help me with this.. Commented Oct 23, 2015 at 7:19

1 Answer 1

1

You can write this like this. Your VF page:

<apex:form>
<apex:selectRadio value="{!ProceedWithPlan}" Id= "proceedWithPlanId" >
    <apex:selectoption itemLabel ="Yes" itemvalue="yes" id="yesid" rendered ="{!isProfileAboveDirector}"> </apex:selectoption>
    <apex:selectoption itemLabel ="No" itemvalue="No" id="noId"> </apex:selectoption>
</apex:selectRadio>
</apex:form>

And your controller for that page:

public Boolean ProceedWithPlan {get; set;}
public Boolean isProfileAboveDirector {get; set;}

Please rate my answer if this helps you.

2
  • rendered ="{!isProfileAboveDirector}" should be on the No option.
    – smukov
    Commented Oct 23, 2015 at 8:27
  • He want that two buttons render if isProfileAboveDirector == true. So my answer is right. Commented Oct 23, 2015 at 8:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .