Checkbox Formula Field in Visualforce

May 21, 2009 · Filed Under Apex, Development, Visualforce, salesforce.com 

In keeping with the theme of checkboxes and formulas, we provide an easy way to create a checkbox formula field using Visualforce: the checkbox tag with the disabled attribute:

First, the Apex controller method:

public boolean checkformula(){
boolean b = [insert formula here];
return b;
}

And the visualforce code:

<apex:inputCheckbox disabled="true" value="{!checkformula}"/>

That's it! Of course, there are many ways to set up the Apex method, but the important piece is the Visualforce markup. By using a tag usually associated with an edit page but making it disabled, the checkbox becomes an output field.

Comments

1 Tweet

Leave a Reply




Additional comments powered by BackType