1

Visualforce page:

<apex:commandButton value="Submit" action="{!Submit}" rendered="{!CanSubmit}" />

Currently I have this following code in my Apex:

 public boolean CanSubmit
 {
 get
   {            
     if(employee.Status__c == EmployeeStatus.get('Submit').getValue())
     {
       return true;
     }
     else
     {
       return false;
     }          
   }
 }

Now, I need to add few more condition to the Submit button whether to show the button but I'm not sure how to achieve this since I already have rendered={!CanSubmit}, how should I add extra condition to rendered?

rendered="{!IF($Profile.Name =='System Administrator'||$Profile.Name =='Sales Manager', true , false)}"

1 Answer 1

1

You can try out like this:

rendered="{!(($Profile.Name =='System Administrator'||$Profile.Name =='Sales Manager') && CanSubmit)}"
5
  • 3
    Always replace IF(condition, true, false) with simply condition.
    – Adrian Larson
    Jul 14, 2016 at 20:31
  • @AdrianLarson: I didn't quite get
    – Nick
    Jul 14, 2016 at 20:33
  • Updated the answer, eliminating IF condition. Jul 14, 2016 at 20:35
  • ah, got it now..
    – Nick
    Jul 14, 2016 at 20:37
  • @NickKahn is that working correctly? Jul 14, 2016 at 21:30

You must log in to answer this question.

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