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
Dhruv Khattar 8Dhruv Khattar 8 

Using apex:input to reference a wrapper class member in a visualforce component causes page to crash on rerendering

1. I created a visualforce page
2. I created a component to contain some logic
3. I created a wrapper class to contain an instance of object and some related attributes, so that I could fetch and print a list of those objects in a dataTable/apex:repeat

Then, within the visualforce component:
4. I created a checkbox to rerender the page
5. Based on the selected value, it shows/hides the column containing the <apex:input> tag that references an integer attribute within the wrapper class

Behavior:
On checking/unchecking the checkbox, the presence of the <apex:input> tag referencing a wrapper class member causes the visualforce to crash

The same situation doesn't arise if the <apex:input> exists within the page itself, or if the <apex:input> is replaced with <apex:inputText>

Code sample available here: http://sfdummy.blogspot.com/2017/01/apexinput-in-visualforce-components.html

Appreciate any thoughts!
Best Answer chosen by Dhruv Khattar 8
Ana EscrichAna Escrich
Try to put inputcheckbox inside action region.

    <apex:actionRegion>
        <apex:inputcheckbox id="chkbxAI" value="{!chkbxAI}" >
            <apex:actionSupport reRender="testApexInputForm" id="actfunTAI" event="onclick"/>
        </apex:inputcheckbox>
    </apex:actionRegion>

All Answers

Ana EscrichAna Escrich
Try to put inputcheckbox inside action region.

    <apex:actionRegion>
        <apex:inputcheckbox id="chkbxAI" value="{!chkbxAI}" >
            <apex:actionSupport reRender="testApexInputForm" id="actfunTAI" event="onclick"/>
        </apex:inputcheckbox>
    </apex:actionRegion>
This was selected as the best answer
Dhruv Khattar 8Dhruv Khattar 8
That did the job! Thanks very much!