function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
mrhmrh 

inputCheckbox field not displaying correctly

Hello

 

I have a pageblocktable definition which consists of 8 input rows, and in this table one column is made up of a checkbox field ('Default_sub_account__c' - with a default value of un-selected), however I now want to set the first row (only) of the table to be selected.

 

Rather than create a new field for this with a default value of selected, I was hoping to use an inputCheckbox for the first row, however when I use the following code, the inputCheckbox still appears as unchecked.

 

The correct components are being displayed for the table - i see the tool tip I've defined below on the first row only, however the field is unchecked.

 

Can anyone explain this please?

 

Many thanks,

mark

 

<apex:column style="text-align:center;">

  <apex:facet name="header">

    <apex:outputText styleclass="tableheader view">

      Default

    </apex:outputText>

  </apex:facet>

  <apex:inputCheckbox rendered="{!newFormChild.TF_Position__c == 0}" selected="true" title="dsdsf"/>

  <apex:inputField rendered="{!newFormChild.TF_Position__c != 0}" styleclass="checkall" value="{!newFormChild.Default_sub_account__c}"/>

</apex:column>

Navatar_DbSupNavatar_DbSup

Hi,


According to your checkbox code the first check will display when the value of “newFormChild.TF_Position__c” is 0 and second checkbox will display when the value of” ewFormChild.TF_Position__c” is not equql to 0 means that greater than 0.

 

In the second checkbox if your are binding the Boolean merge field and the merge field has a true value then second checkbox will display in selected mode other wise it will display in uncheck mode.

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved. 

 

 

mrhmrh

Hi Ankit

 

Thanks for the response although not sure it has answered it for me.

 

My issue is why the first checkbox (the apex:inputcheckbox) is not displaying as checked/selected, even though I have defined the selected="true" option for it.

 

To unblock my work, I had to create a second checkbox field e.g. Default_sub_account_checked__c, with a default value checked and reference that as an inputfield instead for the first row.

 

 

-----------

Is it not possible to overrright the default value (defined in the custom field definition) when using apex:inputfield or apex:inputcheckbox?

 

Thanks

Mark