You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Marc Fonteijn <ma...@unplug-it.nl> on 2005/05/02 12:07:26 UTC

dataScroller submit form

Hi all,

I want to make sure all required fields are filled and fire a custom  
action before scrolling to a new page. The problem is that dataScroller  
only submits the form when next is pressed on the last page. Is there a  
way to force the dataScroller to submit (validate) the form before  
scrolling to a new page?

Changing the <h:outputText id="nextAndSubmit" value="next"/> to  
<h:commandLink id="nextAndSubmit" action="#" value="next" /> in the  
example below, does submit and validate the form but it doesn't scroll to  
the next page.

Code example:
========================
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://myfaces.apache.org/extensions" prefix="x"%>

<f:view>
<html>
<head>
</head>
<body>
   <h:form id="someForm">
     <h:dataTable id="someTable" var="item"  
value="#{applicationBean.someItems}" rows="2">
       <h:column>
         <h:outputText id="someOutputText" value="#{item}" />
         <h:inputText id="someInputText" required="true"/>
         <h:message for="someInputText" />
       </h:column>
       <f:facet name="footer">
         <x:dataScroller id="scroller" pageCountVar="pageCount"  
pageIndexVar="pageIndex">
           <f:facet name="previous">
               <h:outputText value="previous"/>
           </f:facet>
           <f:facet name="next">
             <h:outputText id="nextAndSubmit" value="next"/>
             <%--<h:commandLink id="nextAndSubmit" action="#" value="next"  
/>--%>
           </f:facet>
         </x:dataScroller>
       </f:facet>
     </h:dataTable>
   </h:form>
</body>
</html>
</f:view>
========================

Thanks,
Marc.

-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/