Ajax Validation on JSF

I want to validate required fields on diferent forms when i push on save (Toolbar.xhtml). How can i do this? Thanks in advance

I have the following code:

Father.xhtml

..
<ui:include src="/jsf/Toolbar.xhtml"/>
<ui:include src="/jsf/Adquisicion.xhtml"/>
..

Toolbar.xhtml

<ui:composition 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"
      >

 <ui:insert name="toolbarComponent">
  <h:form name="ToolbarForm" >
    <a4j:commandLink id="save" action="#{backingBean1.save}"/>
  </h:form>
 </ui:insert>

</ui:composition>    

Adquisicion.xhtml

<ui:composition 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">

 <ui:insert name="component">
   <a4j:form id="Adquisicion">
     <rich:panel>
       <f:facet name="header">
          <h:outputText value="Header" />
       </f:facet>
       <h:panelGrid columns="3">
  <h:outputText value="Name" />
  <h:inputText id="nameId" value="#{adquisicion.name}"                 style="width:500px;" required="true" requiredMessage="Required" >
            <a4j:support event="onblur"/>
         </h:inputText>
  <rich:message for="nameId" style="color: red;"/>
     </rich:panel>
   <a4j:form> 
 </ui:insert>
<ui:composition> 

Answers


The input fields have to go in the same <h:form> (or <a4j:form>, whatever you like) as the command link/button.


Need Your Help

CreateCompatibleBitmap Vs SelectObject

mfc scale cdc cbitmap

I'm wondering , if I want to create different bitmaps,

Subtracting 2 dates

c# .net

I need to be able to subtract 2 dates and get back the years and months between the 2.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.