[SalesForce] Visualforce: Adding CSS class from Controller

Is it possible to add a CSS class to one of the Visualforce page objects from controller?
What I want to achieve is to handle one exception in controller. From catch block I want to be able to hide a form (add a CSS class to form with display:hidden).

Best Answer

Create a variable in your controller,

public boolean isVisible{gt;set;}

assign it true/false depending on condition(exception in your case)

surround form you want to show by an output panel

<apex:outputPanel rendered="{!isVisible}">
<apex:form>
.
.
.
.
</apex:form>
</apex:outputPanel>
Related Topic