+ Start a Discussion
Steve ChadbournSteve Chadbourn 

Checkbox Display Bug?

If I create a checkbox field and display it on a visualforce page using inputField it displays with a label on each side:
It appear fine however when using an outputField. This is different to the behaviour on standard salesforce pages where the label appears correctly on the left when in edit mode.
My only workaround at the moment is to drop the label on the left but that leaves the checkbox looking strange with its label on the right where all other controls have labels on the left.
Is this a bug? I'm guessing it is the way the control is rendered using the <input tag and can be fixed as it works fine on the standard salesforce pages.
You are correct, that is a bug.  And it has already been fixed in the next release.

In the meantime your workaround is to replace the current inputField with:

  <apex:outputLabel for="approval" value="Medical Prior Approval Request"/>
  <apex:inputCheckbox id="approval" value="{!myObject__c.approvalRequest__c}"/>

A bit more code than you'd like to have in there, I know.  But it should get things looking right for now.

Steve ChadbournSteve Chadbourn

Thanks. That worked a treat!

I hadn't thought of using inputCheckbox like that - it makes me think I can use the other input Controls to get around the tab order problem ie inputField has no tabindex property but inputText etc do have. I'll give it a go and report back.

BTW any news on tab order updates in the next release?

Steve ChadbournSteve Chadbourn

That worked a treat thanks!

Using inputCheckbox in this way has made me think about the other input components and if they can help me with the tab index problem eg inputText etc have a tabindex property but inputField does not. I'll give it a go and report back.

BTW has tabindex been added to inputField in the latest release or some other way been provided to address the tabbing shortcomings?