Differences between revisions 3 and 4
Revision 3 as of 2006-10-13 15:15:52
Size: 1677
Comment: eol added
Revision 4 as of 2009-09-20 23:01:46
Size: 1677
Editor: localhost
Comment: converted to 1.6 markup
No differences found!

Overview

Updates the backend data model through ajax so no form submit button is required.

Usage

 <s:inputTextAjax value="#{inputAjaxBean.text2}"
      id="text2"
      forceId="true"
      [onSuccess="successful"
      onFailure="failure"
      onStart="starting"
      showOkButton="true"
      showCancelButton="true"]/>
  • onSuccess - called when an update is completely successful.
  • onFailure - called when an update fails
  • onStart - called when the update starts

Note: Do not include the brackets in these function callbacks. Note 2: These functions accept two values (elementName, elementValue), for example:

function successful(elname, elvalue)
    {
        // do something here
    }

Error Handling

For validation errors or error handling, simply define a <t:message> tag (must be a tomahawk message!, not h:message). Here's an example:

 <h:outputText value="Input a Date"/>
            <h:panelGrid columns="1">
                <s:inputTextAjax value="#{inputAjaxBean.date1}"
                                 id="date1"
                                 forceId="true">
                    <s:convertDateTime pattern="yyyy-MM-dd"/>
                </s:inputTextAjax>
                <t:message for="date1" styleClass="error"/>
            </h:panelGrid>

Note - This component is different to others, it uses Ajax mechanisms to fetch data from the server, thus the backend binding can and will be used outside of the standard JSF lifecycle to deliver the data.

Use always within a form tag.

see examples/sandbox/inputAjax.jsp for an example.

InputTextAjax (last edited 2009-09-20 23:01:46 by localhost)