2 Replies Latest reply on Nov 22, 2010 6:18 AM by Cvetelin Andreev

    Skip validation

    Cvetelin Andreev Newbie



      I'm using richfaces 3.3.3 with spring web flow.

      I have a facelets component for a combobox that includes a special item (select item). After selecting the item, an action is invoked. Here is the code


      <h:selectOneMenu id="#{id}" value="#{value}" required="#{required}">


                  <f:selectItems value="#{selectItems.items}" />



                      test="#{selectItems.action != 'none'>



                      <f:selectItem itemLabel="#{msg.global_new_entry}" itemValue="" />


                      <a4j:support id="new_entry_ajax_region_#{id}" event="onchange"

                          rendered="#{showNewElement}" status="commonstatus"

                          action="#{selectItems.newAction}" reRender="#{flowRenderFragments}"

                          ajaxSingle="true" process="#{process}"


                          onsubmit="if (#{rich:element(id)}.value != '') {change_#{id}(); return false;}">







      The problem is that I dont want the special item to be a valid value for the combo. When I select it, validation is performed so the action is not called. I cannot put immediate="true" because I want the model to be updated. This special item is used to create an entry and populate it back in the combo. This is the case if required="true".

        • 1. Re: Skip validation
          Ilya Shaikovsky Master

          so create your custom validator and use instead of just required="true"

          • 2. Re: Skip validation
            Cvetelin Andreev Newbie

            This custom validator will be invoked in both cases: when I submit from the component new_entry_ajax_region_#{id} or when I submit the whole form with the combobox inside. In the first case the special select item (#{msg.global_new_entry}) should be valid value, but in the second this value should be invalid. How can I differentiate the two cases in the validator? I don't know how to get the current action event in the validator.


            A workaround I implemented is that my special item is replaced with command button next to the combobox. The difference is that now I can tell the button to process everything, but the combo.