How to disable validation when selecting tab ?
chawax Oct 5, 2007 4:02 AMHi,
I have a tabPanel component with switchType ajax. It contains two tabs with input fields, including calendars.
My problem is that when I select a tab the validation phase is runned, so I can't change tab until I filled all required fields. I'd like the validation to happen only when I submit my form, not when I change tab. I tried to add immediate="true" to my tabPanel, I have no more validation problems, but then I have a problem with converter when the form is submitted :
Exception during request processing: Caused by javax.servlet.ServletException with message: "No Converter for type java.util.Date found"
What is the good way to do this ?
My JSP page is as following :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:s="http://jboss.com/products/seam/taglib" xmlns:rich="http://richfaces.org/rich" xmlns:a4j="http://richfaces.org/a4j"> <ui:composition template="/WEB-INF/templates/template.xhtml"> <ui:define name="body"> <f:view> <rich:messages /> <rich:panel > <h:form> <rich:tabPanel switchType="ajax" immediate="true"> <rich:tab label="#{messages['label.ongletInfosGenerales']}"> <h:panelGrid columns="2"> <h:outputLabel value="#{messages['label.matricule']} :" for="matricule" /> <h:inputText id="matricule" value="#{employe.matricule}" required="true" /> <h:outputLabel value="#{messages['label.prenom']} :" for="prenom" /> <h:inputText id="prenom" value="#{employe.prenom}" required="true" /> <h:outputLabel value="#{messages['label.nom']} :" for="nom" /> <h:inputText id="nom" value="#{employe.nom}" required="true" /> </h:panelGrid> </rich:tab> <rich:tab label="#{messages['label.ongletCompteUtilisateur']}"> <h:panelGrid columns="2"> <h:outputLabel value="#{messages['label.utilisateur']} :" for="utilisateur" /> <h:inputText id="utilisateur" value="#{compteUtilisateur.username}" required="true" /> <h:outputLabel value="#{messages['label.motDePasse']} :" for="motDePasse" /> <h:inputSecret id="motDePasse" value="#{compteUtilisateur.password}" required="true" /> <h:outputLabel value="#{messages['label.dateExpirationCompte']} :" for="dateExpirationCompte" /> <a4j:region> <rich:calendar id="dateExpirationCompte" value="#{compteUtilisateur.dateExpirationCompte}" datePattern="#{messages['datePattern']}" popup="false" locale="#{locale}" enableManualInput="true" required="true" /> </a4j:region> </h:panelGrid> </rich:tab> </rich:tabPanel> <h:commandButton id="modifier" value="#{messages['label.modifier']}" action="#{employeCrud.update}" rendered="#{employe.id != null}" /> <h:commandButton id="creer" value="#{messages['label.valider']}" action="#{employeCrud.create}" rendered="#{employe.id == null}" /> <h:commandButton id="annuler" value="#{messages['label.annuler']}" action="#{employeCrud.annuler}" immediate="true" /> </h:form> </rich:panel> </f:view> </ui:define> </ui:composition> </html>
I use Richfaces 3.1 with Seam 2.0.0.CR1 and JSF 1.2.
Thanks in advance.