Bypassing validation on h:inputText
sandman202 Apr 6, 2009 11:09 PMI have a uzerList.xhtml which performs a search. The h:inputText search fields are performing validations defined on the properties from the uzer entity. Is there a way to bypass the validation?
uzerList.xhtml
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
 xmlns:s="http://jboss.com/products/seam/taglib"
 xmlns:ui="http://java.sun.com/jsf/facelets"
 xmlns:f="http://java.sun.com/jsf/core"
 xmlns:h="http://java.sun.com/jsf/html"
 xmlns:rich="http://richfaces.org/rich"
 template="/layout/template.xhtml">
<ui:define name="body">
 <h:form id="uzerSearch" styleClass="edit">
 <rich:simpleTogglePanel label="User Search Parameters" switchType="ajax">
 ...
 <s:decorate template="/layout/display.xhtml">
 <ui:define name="label">Name</ui:define>
 <h:inputText id="name" value="#{uzerList.uzer.name}"/>
 </s:decorate>
 <s:decorate template="/layout/display.xhtml">
 <ui:define name="label">Email</ui:define>
 <h:inputText id="email" value="#{uzerList.uzer.email}" immediate="true" required="false"/>
 </s:decorate>
 ...
 </rich:simpleTogglePanel>
 <div class="actionButtons">
 <h:commandButton id="search" value="Search" action="/role/admin/UzerList.xhtml" />
 </div>
 </h:form>
 <rich:panel>
...
</ui:define>
</ui:composition>
uzer.java
@Entity
public class Uzer implements Serializable
{
...
 // seam-gen attributes (you should probably edit these)
 private Long id;
 private Integer version;
 // add additional entity attributes
 private String name;
 private String email;
...
 // seam-gen attribute getters/setters with annotations (you probably should
 // edit)
 @Id
 @GeneratedValue
 @Column(name = FIELD_ID)
 public Long getId() {
 return id;
 }
 public void setId(Long id) {
 this.id = id;
 }
 @Version
 @Column(name = FIELD_VERSION)
 public Integer getVersion() {
 return version;
 }
 @SuppressWarnings("unused")
 private void setVersion(Integer version) {
 this.version = version;
 }
...
 @Length(min=1, max = 40)
 @NotNull
 // @Pattern(regex = "[a-zA-Z]+", message =
 // "Last name must only contain letters")
 @Column(name = FIELD_NAME, nullable = false, length = 40)
 public String getName() {
 return name;
 }
 public void setName(String name) {
 this.name = name;
 }
 @Email
 //@NotNull
 @Column(name = FIELD_EMAIL)
 public String getEmail() {
 return email;
 }
 public void setEmail(String email) {
 this.email = email;
 }
...
}
When I press the search button on the xhtml, messages appear. One for the name field something like: "must be between 1 and 40" and one for the email with something like: "not a well formed email address". I do not want to validate on search parameters.
How do I bypass this?
 
    