2 Replies Latest reply on Dec 26, 2007 7:00 PM by Thorsten Kunz

    Possible to turn off validation for search value object in E

    Thorsten Kunz Novice

      I have a User class which has an email string field annotated with @NotNull @Email.
      I used seam-gen to generate everything for it. UserList, UserHome, etc. Now when I try to search for a username in the generated UserList.xhtml I get an error "must be a well-formed email address". So I guess that even for the object used to hold the search parameters validation is enabled. Is it possible to turn this off? Don't think it makes any sense at all to validate search strings. Now I could write an extra class to only hold the search parameters but switching validation off for the search parameter object would seem nicer to me.

      Thanks, Thorsten

        • 1. Re: Possible to turn off validation for search value object
          Daniel Young Novice

          Hi Thorsten,

          Yes, you just need to make sure your search field is not wrapped in s:validate or s:validateAll tags. There was somebody else with this problem a few days ago, and they had s:decorate with the edit.xhtml template which includes the validate tags.

          Hibernate validation will only occur at the UI level if your fields are wrapped in these tags. It will also occur if you try to persist the entity, but I imagine you aren't doing this when using it as a search object.

          hope this helps,
          Daniel.

          "SunFire" wrote:
          I have a User class which has an email string field annotated with @NotNull @Email.
          I used seam-gen to generate everything for it. UserList, UserHome, etc. Now when I try to search for a username in the generated UserList.xhtml I get an error "must be a well-formed email address". So I guess that even for the object used to hold the search parameters validation is enabled. Is it possible to turn this off? Don't think it makes any sense at all to validate search strings. Now I could write an extra class to only hold the search parameters but switching validation off for the search parameter object would seem nicer to me.

          Thanks, Thorsten


          • 2. Re: Possible to turn off validation for search value object
            Thorsten Kunz Novice

            Well this is what I though as well but the search panel generated by seam-gen as of 2.0.1.CR1 does already decorate the search fields with layout/display.xhtml and not layout/edit.xhtml. And in display.xhtml I do not see any validator wrappings so I am confused of where the validation is actually triggered because I don't see any in the .xhtml files involved in the search.