1

I have a pretty standard use case where I have a PageBlockTable where you can select any number of rows to process.

//wrapper class
public class CaseWrapper{
    public Boolean selected {get; set;}
    public Case case {get; set;}

    public CaseWrapper(){
        selected = false;
    }
}

//VF page
<apex:pageBlockTable id="table" value="{!caseWrappers}" var="caseWrapper">
    <apex:column>
        <apex:inputCheckbox value="{!caseWrapper.Selected}">
           <apex:actionSupport event="onchange" rerender="table" />
        </apex:inputCheckbox>
    </apex:column>
    <apex:column>
       <apex:inputField value="{!caseWrapper.Status}" required="{!caseWrapper.Selected}" />
    </apex:column>
</apex:pageBlockTable>

This seems to work until I trigger a required field error and THEN uncheck the selection box. Instead of becoming un-required again, the required fields stay.

enter image description here

6
  • 2
    Have you tried rerendering the entire pageBlockTable?
    – Rob
    Aug 27, 2015 at 16:16
  • 1
    @NSjonas I belive you should rerender the the entire <apex:pageBlockTable not only the <apex:column. As the <apex:column is dependent on <apex:pageBlockTable.
    – Saroj Bera
    Aug 27, 2015 at 16:17
  • actually it only half works. After you trigger a required field, if you unselect it, the field stays required
    – NSjonas
    Aug 27, 2015 at 16:41
  • 1
    actionregion is what you want Aug 27, 2015 at 16:54
  • <apex:column does not have required attribute ? How do you use this in your code ?
    – MIX DML
    Aug 27, 2015 at 17:04

1 Answer 1

0

Try wrapping that pageblock table in apex output panel with some 'id' and rerender that apex output panel

You must log in to answer this question.

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