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.. – Shaik Imran Oct 23 '15 at 7:19
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 Oct 23 '15 at 8:27
  • He want that two buttons render if isProfileAboveDirector == true. So my answer is right. – Yaroslav Maksymenko Oct 23 '15 at 8:43

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.