views:

473

answers:

1

Hello,

Let's consider following, simplified example:

we have 2 tabs withing , each tab has and at the moment we want to switch from one tab to another, and the inputText is empty (we dont want to submit value from it anyway, we want to go to another tab) we get "Validation Error: Value is required."

the example code:

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
 <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:a4j="http://richfaces.org/a4j"
    xmlns:rich="http://richfaces.org/rich"
 >
        <a4j:form
            id="mainForm"
            reRender="mainForm"
            ajaxSubmit="true"
        >
            <rich:tabPanel switchType="ajax">
                <rich:tab label="TabA" >
                    <a4j:region>
                        <h:outputText value="Tab A content" />
                        <h:inputText value="" required="true" />
                    </a4j:region>
                </rich:tab>
                <rich:tab label="TabB">
                    <a4j:region>
                        <h:outputText value="Tab B content" />
                        <h:inputText value="" required="true" />
                    </a4j:region>
                </rich:tab>
            </rich:tabPanel>
            <rich:messages />
        </a4j:form>
 </html>
+1  A: 

You should add the "immediate" attribute to the tabPanel. To quote the docs this means that the tabPanel:

"...component value must be converted and validated immediately (that is, during Apply Request Values phase), rather than waiting until a Process Validations phase"

For example:

<rich:tabPanel switchType="ajax" immediate="true">
Damo
thanks, that's solves the problem :-)
JQueryNeeded