Sends a form through ajax.


Build a form like normal, but use x:commandButtonAjax instead of s:commandButton (or standard h:commandButton)

    <h:outputText styleClass="standard_bold" value="Form Submit via AJAX"/>
    <h:panelGrid columns="2">
    <h:panelGrid columns="2">
        <t:inputText id="formText1" value="#{inputAjaxBean.formText1}"
        <t:message for="formText1" forceSpan="true" styleClass="errorMessage"/>

        <t:inputText id="formText2" value="#{inputAjaxBean.formText2}"
        <t:message for="formText2" forceSpan="true" styleClass="errorMessage"/>

        <s:commandButtonAjax action="#{inputAjaxBean.ajaxFormSubmit}" value="Submit"/>
        <h:outputText value="&nbsp;" escape="false"/>
    <f:verbatim>This component demonstrates submitting a form through ajax.</f:verbatim>

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

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.

HtmlCommandButtonAjax (last edited 2009-09-20 23:01:56 by localhost)