Find your content:

Search form

You are here

OutputCheckBox?

 
Share

This may be a easy question for some of you, I really hope so. I'm trying to get an "output Checkbox". I'm building a visualforce page and I need to expose check boxes results on that page. I tried the "outputField" but it doesn't show the tick box.

<apex:pageBlockSectionItem >
    <apex:outputLabel value="Custom Field" for="customField"/>
    <apex:outputField id="customField" value="{!Account.customField__c}"/>
</apex:pageBlockSectionItem>

On that code the CustomField__c is a tick box.

So, how can I accomplish this, because there is not an outputCheckBox and the inputCheckBox is not going to work either?


Attribution to: Carlos Naranjo

Possible Suggestion/Solution #1

You could also do this:

            <apex:outputPanel rendered="{!r.isSuccess}" layout="block">
                <input type="checkbox" disabled="disabled" checked="checked"/>
            </apex:outputPanel>
            <apex:outputPanel rendered="{!NOT(r.isSuccess)}" layout="block">
                <input type="checkbox" disabled="disabled" />
            </apex:outputPanel>

Then you don't need an apex:form tag.


Attribution to: Dovid

Possible Suggestion/Solution #2

What about using the following code instead?

<apex:column headerValue="Custom Field">

<img src="/img/checkbox_{!IF(!Account.customField__c == TRUE, '', 'un')}checked.gif" />

</apex:column>

Attribution to: Neena B

Possible Suggestion/Solution #3

I believe I have a better answer.

<apex:inputcheckbox value="{!FieldName}"  onclick="return false" />

Instead of disabled = true. My solution doesn't render a greyed out checkbox, but when the user clicks nothing happens


Attribution to: Brian Barrett

Possible Suggestion/Solution #4

According to my understanding, you want to display a checkbox with checked mark and it's a read only field. You can achieve that by doing like this:

<apex:inputcheckbox value="{!Account.customField__c}" label="Same as Above" selected="True" disabled ="true">

If it's not can you explain clearly what you want to display on vf page


Attribution to: kiran

Possible Suggestion/Solution #5

The <apex:outputField value="{!your Value}"/>shows the check box with tick mark. The other methods like <apex:inputcheckbox disabled=true> also work but I found this visually good.


Attribution to: Srujan
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/32524

My Block Status

My Block Content