10 Replies Latest reply on Jun 12, 2013 4:53 AM by wish79

    Validation message disappear

    wish79

      Hello All,

      I have a validation on my fileds JSR-303 when i press the button all message appear ,the problem is after fix one of theses messages all other message disappaer i.e(i want the message still appear till i fix the error)

       

      code :

       

      <rich:select  id="addType"

                        defaultLabel="#{msg.GEN_SELECT_VALUE} #{lbs.OUT_TYPE}"

                        

                        value="#{outsourcedBacking.addOutSourcedBean.type.id}"

                        valueChangeListener="#{outsourcedBacking.addRepTypeChangeListener}" >

           <f:selectItems value="#{outsourcedBacking.populateLKPListByParentId(1)}"/>

              <a4j:ajax event="change" />

             

          </rich:select>

         

          <rich:message id="addTypeMSG" for="addType" />

       

       

           <h:panelGroup>

                      <h:outputLabel for="addNameAr" value="#{lbs.OUT_NAME_AR}" />

                      <h:outputLabel for="addNameAr" value="#{lbs.GEN_SPERATOR}" />

                      <h:outputLabel for="addType" value="#{lbs.GEN_REQUIRED}" styleClass="required" />

          </h:panelGroup>

          <h:inputText id="addNameAr"

                       valueChangeListener="#{outsourcedBacking.arNameChangeListener}"

                       value="#{outsourcedBacking.addOutSourcedBean.nameAr}" 

                       maxlength="100"

                       size="100" >

           <a4j:ajax event="change" />

          

          </h:inputText>

          <rich:message for="addNameAr" />

         

          <h:panelGroup>

                      <h:outputLabel for="addNameEn" value="#{lbs.OUT_NAME_EN}" />

                      <h:outputLabel for="addNameEn" value="#{lbs.GEN_SPERATOR}" />

                      <h:outputLabel for="addType" value="#{lbs.GEN_REQUIRED}" styleClass="required" />

          </h:panelGroup>

          <h:inputText id="addNameEn" valueChangeListener="#{outsourcedBacking.enNameChangeListener}" value="#{outsourcedBacking.addOutSourcedBean.nameEn}"  maxlength="100" size="100" >

           <a4j:ajax event="change" />

          </h:inputText>

          <rich:message for="addNameEn"  />

       

       

       

      Reagrds

      Mohd.Weshah

        • 1. Re: Validation message disappear
          bleathem

          Try setting the execute attribute of your a4j:ajax tags to execute the whole form.

          • 2. Re: Validation message disappear
            wish79

            Thanks,

            but as we know the default execute for <a4j:ajax is @this not @form .

            • 3. Re: Validation message disappear
              bleathem

              Yes, that's the default, and that's why I'm suggesting you try changing it...

              • 4. Re: Validation message disappear
                wish79

                Thank, it is working now but in the demo showcase they are not use the a4j:ajax and the validation is working and fireing without any problem

                 

                http://showcase.richfaces.org/richfaces/component-sample.jsf?demo=clientValidation&sample=jsr303&skin=blueSky

                • 5. Re: Validation message disappear
                  bleathem

                  Not all Bean Validation rules are implemented on the client-side.  Those rules which are not implemented in javascript (custom bean validation rules for instance) will always need an ajax call to evaluate.  The showcase example uses BV rules that have a javascript implementation.  See:

                   

                  http://docs.jboss.org/richfaces/latest_4_3_X/Component_Reference/en-US/html_single/#sect-Component_Reference-richvalidator-Ajax_fall-backs

                  • 6. Re: Validation message disappear
                    wish79

                    But all my validation is client side not customized read this : https://community.jboss.org/message/822491#822491

                    • 7. Re: Validation message disappear
                      bleathem

                      Can you post the code for the Bean in question, so we can see what the BV annotations look like?

                      • 8. Re: Validation message disappear
                        wish79

                        @Entity(name="DW_OUT_SOURCED")

                        @Table(name="DW_OUT_SOURCED")

                        @TableGenerator(name = "outsourcedGenerator", table = "DW_SEQUENCE", schema = "DIWAN", pkColumnName = "SEQ_NAME", valueColumnName = "SEQ_VALUE", pkColumnValue = "OUT_SOURCED_SEQUENCE", allocationSize = 1, initialValue = 0)

                         

                         

                        public class OutsourcedBean extends BaseBean{

                         

                                  @Id

                                  @GeneratedValue(strategy = GenerationType.TABLE, generator="outsourcedGenerator")

                                  @Column(name="ID")

                                  private int Id;

                         

                                  @NotEmpty(message="{GEN_REQUIRED}" , groups={AddValidationGroup.class , EditValidationGroup.class,ManageValidationGroup.class})

                                  @JoinColumn(name="TYPE_ID",referencedColumnName="ID",nullable=false)

                                  @ManyToOne

                                  private ChildLKPBean type;

                         

                                  @NotEmpty(message="{GEN_REQUIRED}" , groups={AddValidationGroup.class , EditValidationGroup.class})

                                  @Column(name="NAME_AR",length=100, nullable = false,unique = true)

                                  private String nameAr;

                         

                                  @NotEmpty(message="{GEN_REQUIRED}" , groups={AddValidationGroup.class , EditValidationGroup.class})

                                  @Column(name="NAME_EN",length=100, nullable = false,unique = true)

                                  private String nameEn;

                         

                                  @Column(name="PERSON_NAME",length=200)

                                  private String personName;

                         

                                  @Column(name="PHONE_NUMBER",length=20)

                                  private String phoneNumber;

                         

                                  @Column(name="FAX_NUMBER",length=20)

                                  private String faxNumber;

                         

                                  @Column(name="MOBILE_NUMBER",length=20)

                                  private String mobileNumber;

                         

                                  @Column(name="POBOX",length=200)

                                  private String pobox;

                         

                                  @Column(name="EMAIL_ADDRESS",length=200)

                                  @Email(message="{GEN_EMAIL_FORMAT_IS_NOT_CORRECT}",groups={AddValidationGroup.class , EditValidationGroup.class})

                                  private String emailAddress;

                         

                                  @Column(name="NOTE",length=200)

                                  private String note;

                         

                                  @Column(name="ORDER_ID",length=10)

                                  private int order;

                        • 9. Re: Validation message disappear
                          bleathem

                          You aren't using the Bean Validation annotations.  Try uinsg @Size, @NotNull, etc.

                          • 10. Re: Validation message disappear
                            wish79

                            Dear Brian

                            it solved the disappear problem when i change the a4j:ajax execute to @form but this soluation cuase another problem which is when there is another filed validation fail the current field value dose not change becuase the form validation falid

                             

                            Regards

                            Wish