Table of Contents



Ajax behavior of the ICEmobile components can be customized with the use of the <mobi:ajax /> tag. Both JavaScript and synthetic events (Component-defined) are supported. While the ICEmobile components support both the singleSubmit attribute and mobi:ajax tag, mobi:ajax takes precedence over singleSubmit.
At the moment, it is not possible to wrap a number of components inside the tag (as with f:ajax), but each component needs to have its own nested tag.

Many of the attributes of the <mobi:ajax /> tag are similar to those of the <f:ajax /> tag and <ice:ajax /> tag. They are described below:

event - the event that will trigger the ajax request. If this attribute is not specified, then the default event for the component will be used.
execute - A space-delimited list of component ids to execute in the request. The keywords @all, @form, @this, and @none are also supported.
render - A space-delimited list of component ids to be rendered in the response. The keywords @all, @form, @this, and @none are also supported.
listener - A server-side method to call when the request is fired. The method must be public, return void and take a javax.faces.event.AjaxBehaviorEvent object as the only parameter.
disabled - Boolean value to disable/enable the ajax capabilities of the component.

In addition to these attributes that are similar to <f:ajax />, another set of attributes are supported that offer more control over the ajax request on the client side. For example, by using the onStart attribute, it is possible to decide whether the ajax request is sent or not to the server, on the client-side.

onStart - Client-side callback to execute before the request is sent to the server. If this callback returns false (including null, undefined, 0, and the empty string), then the ajax request will be aborted. This function must return true (or any value that doesn't evaluate to false) to allow the ajax request to continue.
onSuccess - Client-side callback to execute when the ajax request is sucessful (i.e. a 200 status code).
onError - Client-side callback to execute when there was an error with the request/response.
onComplete - Client-side callback to execute when the ajax request is completed. It fires after onSuccess or onError are called.

It is also possible to nest more than one <mobi:ajax /> tag in the same component, even though they may specify the same event. A separate ajax request will be made for each tag.


<h:form id="form1">
    <h:outputText value="Select values for execute and render below to test"/>
    <mobi:flipswitch value="#{input.boolean1}" id="ajaxOne" labelOn="ON" labelOff="OFF">
        <mobi:ajax event="activate" execute="@this" render="valueA" />
    <h3>Form 1</h3>
    <span>Value A: </span><h:inputText id="valueA" value="#{input.testBool}" />
    <span>Value B: </span><h:inputText id="valueB" value="#{input.testBool}" />

this will execute the flipswitch element and update only the valueA area. Using singleSubmit to true on this component is equivalent to execute="@this" render="@all".

This section covers attributes involved in the typical use-cases for this component. For reference, the complete taglib documentation for this component is available here.

Tag Handler Documentation


Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.

© Copyright 2016 ICEsoft Technologies Canada Corp.