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
Donald Reagan 3Donald Reagan 3 

Dynamically switch from inputfield to inputcheckbox for number field

I have an object field that is of number data type, based on a picklist value in the parent object field I want to render in the visual force page as an input check box. If the check box is checked true, I want the value saved to 1 and 0 if false. If the picklist value requires it to render as a text field and I want to save the value as a number field. I'm successful in rendering the field as inputcheckbox and inputfield, but its not saving the checkbox value to the field. It is saving the value if it is rendered as a text box.
<apex:datatable value="{!attendanceRows}" var="o" id="theTable"

<apex:inputField value="{!o[column01.FieldName]}"  rendered="{!IF(c.Type__c='High School',true,false) }"/> 
<apex:inputCheckbox value="{!o[column01.FieldName]}"  rendered="{!IF(c.Type__c='Middle School',true,false) }"/>

In my controller I'm doing an upsert to the object.
public List<School__c> attendanceRows { get; set; }

public void SaveAttendance() {
    try {
        if (attendanceRows.size() > 0) {
            upsert attendanceRows;
        }
    }
    catch(DmlException e) {
        System.debug('An unexpected error has occurred while saving to School__c: ' + e.getMessage());
    }

}

// Header Definition Class
public with sharing class HeaderDefinition
{
    public HeaderDefinition(Boolean pIsVisible, String pColumnName, String pFieldName)
    {
        isVisible = pIsVisible;
        ColumnName = pColumnName;
        FieldName = pFieldName;
    }

    public Boolean isVisible { get; set; }
    public String ColumnName { get; set; }
    public String FieldName { get; set; }

    public string outString()
    {
        return FieldName + ' :: ' + ColumnName + ' - ' + String.valueOf(isVisible);
    }
}

SaveAttendance();

How do I save/get the value of the inputcheckbox?