2 Replies Latest reply on Aug 12, 2011 10:50 AM by Jeff Pusczek

    Not validating @Size(min=1) on selectManyCheckbox

    Jeff Pusczek Newbie

      Hello

       

      I have the code below

       

                                    <h:selectManyCheckbox
                                          value="#{scheduleBean.scheduleMetaDataDTO.selectedDays}"
                                          rendered="#{scheduleBean.showDaysCheckboxes}"
                                          layout="lineDirection" id="weeklyDays">
                                          <f:selectItems value="#{scheduleBean.days}" />
                                      </h:selectManyCheckbox>
                                      <rich:message for="weeklyDays"
                                  rendered="#{scheduleBean.showDaysCheckboxes}" />
      

       

      And the valid is bound to

       

           @NotNull
          @Size(min = 1)
          private List<Day> selectedDays;
      

       

      However the @Size validation is never called for this.  When i dont select a checkbox and error is never added.  All other bean validation on the page is working fine

       

      Anyone encounter this

       

      Jeff

        • 1. Re: Not validating @Size(min=1) on selectManyCheckbox
          Jeff Pusczek Newbie

          Im using richfaces 4.0 btw

          • 2. Re: Not validating @Size(min=1) on selectManyCheckbox
            Jeff Pusczek Newbie

            Actually its wierd validation of the component

             

            I added a custom validator that only gets called when i check one of the "selectManyCheckBox" checkboxes.  If i leave them all unchecked then the custom validator never gets called.

             

                           <a4j:outputPanel layout="block" id="scheduleFrequencyPanel">
                                <h:panelGrid cellpadding="0" cellspacing="0"  columns="2" width="100%" columnClasses="scheduleLabel,scheduleInput" id="frequencyGrid">
                                    <asr:parameterLabel for="scheduleFrequency" id="scheduleFrequencyLabel"
                                        displayName="Frequency" required="true" rendered="#{scheduleBean.scheduleMetaDataDTO.scheduleTypeReccuring}" />
                                    <h:panelGrid cellpadding="0" cellspacing="0" columns="4"
                                        rendered="#{scheduleBean.scheduleMetaDataDTO.scheduleTypeReccuring}">
                                        <h:selectOneListbox
                                            value="#{scheduleBean.scheduleMetaDataDTO.scheduleFrequency}"
                                            size="1" id="scheduleFrequency">
                                            <f:selectItem itemValue="#{null}" itemLabel="Select..." />
                                            <f:selectItems value="#{scheduleBean.scheduleFrequencies}" />
                                            <a4j:ajax event="change" render="frequencyGrid"
                                                execute="@this" />
                                        </h:selectOneListbox>
                                            <h:selectManyCheckbox
                                                value="#{scheduleBean.scheduleMetaDataDTO.selectedDays}"
                                                rendered="#{scheduleBean.showDaysCheckboxes}"
                                                layout="lineDirection" id="weeklyDays">
                                                <f:selectItems value="#{scheduleBean.days}" />
                                                <f:validator validatorId="weeklyDaysValidator" />
                                            </h:selectManyCheckbox>
                                        <rich:message for="weeklyDays"
                                        rendered="#{scheduleBean.showDaysCheckboxes}" />
                                        <rich:message for="scheduleFrequency"
                                        rendered="#{scheduleBean.scheduleMetaDataDTO.scheduleTypeReccuring}" />
                                    </h:panelGrid>
            

             

            Any idea why this is.  I dont have the required="true" on it because i need the message to be custom.  I have a feeling an error is getting swallowed somewhere