2 Replies Latest reply on Jul 12, 2011 8:52 AM by iabughosh

    bean validation and reset issue

    iabughosh

      Dear fellows,

      I've the following issue with bean validation (rich:graphValidator and f:beanValidation), lets assume the I have two fields f1 and f2, and the bean properties are p1 and p2, both of p1 and p2 are constrained with bean validation annotations (lets assume the constrains is @NotEmpty), in the edit mode i get the values from the database and put it into p1 and p2 (for ex : p1="value1" & p2="value2"), now lets make the scenario :

      1-delete p1 value and make it empty and change p2 value to value 3 (p1="" and p2="value3")

      2-press save button, validation get fired and shows the error message (p1 must not be empty).

      3-press reset button, get the values from db and put them into p1 and p2 (p1="value1" p2 ="value2")

      4- the values in the text field are (f1="value1" & f2="value3") .

       

       

      I override the clone method for my bean & I traced the values in my bean in the debug mode but in my page f1 value doesn' render, I've tried to make the render attribute points to my form but no changes.

       

       

      my walkaround : i was calling the reset method with actionListener now I'm using action with faces-navigation return attribute to the same page (return null doesn't work).

       

      my enviroment :

      JDK 1.6

      Tomcat 6

      JSF 2.1

      Rich 4

       

      thanks in advance.

        • 1. Re: bean validation and reset issue
          lfryc

          Hi Inbrahim,

           

          have you tried to use reset button with @execute="@none" and @render="inputs"?

           

          I have inkling that your values are saved into component and thus aren't taken from bean.

          • 2. Re: bean validation and reset issue
            iabughosh

            thanks for the reply,

            i have the same doubt, i think that the value in the textfields is not from my bean, it is from another place, I've tried what you

            asked with execute="@none" but it doesn't work either, but i need the execute attribute for a hidden field id, so i can't use the type "reset" in my button.