I have a custom object


I've added a custom field which is of type check box.


If a system admin ticks this checkbox on the object in the Salesforce UI, I want an apex element to appear in my Visualforce page, by way of the render attribute

<apex:page standardController="MyController">
         <apex:outputLink target="_top" value="page.html" rendered="{!one}">Click here</apex:outputLink>

Here is a stripped down version of my controller:

public with sharing class MyController {

    public Boolean one {get; set;}

    public MyController() {

        String query = 'SELECT id, one__c FROM myObject__c WHERE ID = :myObjectId LIMIT 1';

        myObject__c obj = database.query(query);

        one = obj.one__c;       

Atm, one__c is always returning false, whether or not the box is ticked in the UI. I'm unsure as to the logic I need to add to my controller to 'catch' the state of the check box.

Could anyone help?

2 Answers 2


There doesn't seem to be an issue with your controller. You need to add a mechanism in your VF page to actually rerender a portion of your page when the checkbox is changed. I would use an ActionRegion and ActionSupport to accomplish this.

<apex:outputLink target="_top" value="page.html" rendered="{!one}" id="myLink">Click here</apex:outputLink>

     <apex:inputCheckBox value="{!one}" id="myCheckBox">
          <apex:actionSupport event="onchange" rerender="myLink"/>

This now is now telling your page to rerender your outputlink when the value of the checkbox is changed.

Take a look at the documentation of the ActionRegion tag for a little more info.


  • Thanks for the reply, but the check box is on the object in an admin page. If a System Admin checks the box, a Standard User will then be able to see the above element. The check box isn't actually accessible on my page.
    – Daft
    Commented Aug 27, 2014 at 21:18
  • 1
    Ok, I would add those details to the question so its a bit more clear. Commented Aug 27, 2014 at 23:58

So that leaves myObjectId as loose end. Are you sure that the admin and the user dealing with the same record?

But we can't answer it because we neither see what happens on the admin page nor how myObjectId is initialized.

You must log in to answer this question.

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