Home > Guides > Tag Developers Guide > Struts Tags > Tag Reference > UI Tag Reference > bind

To use this tag:

  • Add: <%@ taglib prefix="sx" uri="/struts-dojo-tags" %> to your page.
  • The head tag must be included on the page, which can be configured for performance or debugging purposes.
  • If the parseContent parameter for the head tag is false (it is false by default), then the id tag is required.

Additional Examples

For more examples see Ajax and JavaScript Recipes

Description

Error formatting macro: snippet: java.lang.IndexOutOfBoundsException: Index: 20, Size: 20

There's a bug in IE6/IE7 which makes impossible to use the target's attribute with a parent Div, because such Div's content's are overwritten with the tag's loadingText. Resulting in an "undefined" message in the content's, instead of the result of the request.

One possible alternative is to set showLoadingText="false" and set the indicator attribute to an element showing the desired loading text or image (outside the div).

<img id="loadingImage" src="images/loadingAnimation.gif" style="display:none"/>
<s:div id="parentDiv">
    <s:form action="actionName">
        <s:submit id="btn" />
        <sx:bind sources="btn" events="onclick" targets="parentDiv" showLoadingText="false" indicator="loadingImage"/>
    </s:form>
</s:div>

Parameters

Dynamic Attributes Allowed:

false
 

Name

Required

Default

Evaluated

Type

Description

afterNotifyTopicsfalsefalseStringComma delimmited list of topics that will published after the request(if the request succeeds)
ajaxAfterValidationfalsefalsefalseBooleanMake an asynchronous request if validation succeeds. Only valid is 'validate' is 'true'
beforeNotifyTopicsfalsefalseStringComma delimmited list of topics that will published before the request
errorNotifyTopicsfalsefalseStringComma delimmited list of topics that will published after the request(if the request fails)
errorTextfalsefalseStringThe text to display to the user if the is an error fetching the content
eventsfalsefalseStringComma delimited list of event names to attach to
executeScriptsfalsefalsefalseBooleanJavascript code in the fetched content will be executed
formFilterfalsefalseStringFunction name used to filter the fields of the form.
formIdfalsefalseStringForm id whose fields will be serialized and passed as parameters
handlerfalsefalseStringJavascript function name that will make the request
highlightColorfalsenonefalseStringColor used to perform a highlight effect on the elements specified in the 'targets' attribute
highlightDurationfalse2000falseIntegerDuration of highlight effect in milliseconds. Only valid if 'highlightColor' attribute is set
hreffalsefalseStringThe URL to call to obtain the content. Note: If used with ajax context, the value must be set as an url tag value.
idfalsefalseStringThe id to use for the element
indicatorfalsefalseStringId of element that will be shown while making request
listenTopicsfalsefalseStringTopic that will trigger the remote call
loadingTextfalseLoading...falseStringText to be shown while content is being fetched
notifyTopicsfalsefalseStringComma delimmited list of topics that will published before and after the request, and on errors
separateScriptsfalsetruefalseStringRun scripts in a separate scope, unique for each tag
showErrorTransportTextfalsetruefalseBooleanSet whether errors will be shown or not
showLoadingTextfalsefalsefalseBooleanShow loading text on targets
sourcesfalsefalseStringComma delimited list of ids of the elements to attach to
targetsfalsefalseStringComma delimited list of ids of the elements whose content will be updated
transportfalseXMLHTTPTransportfalseStringTransport used by Dojo to make the request
validatefalsefalsefalseBooleanPerform Ajax validation. 'ajaxValidation' interceptor must be applied to action

Examples

Without attaching to an event, listening to a topic (used to make an Ajax call):

Error formatting macro: snippet: java.lang.IndexOutOfBoundsException: Index: 20, Size: 20

Attached to event 'onclick' on submit button:

Error formatting macro: snippet: java.lang.IndexOutOfBoundsException: Index: 20, Size: 20

Submit form:

Error formatting macro: snippet: java.lang.IndexOutOfBoundsException: Index: 20, Size: 20

Using beforeNotifyTopics:

Error formatting macro: snippet: java.lang.IndexOutOfBoundsException: Index: 20, Size: 20

Using afterNotifyTopics and highlight:

Error formatting macro: snippet: java.lang.IndexOutOfBoundsException: Index: 20, Size: 20

Using errorNotifyTopics and indicator:

Error formatting macro: snippet: java.lang.IndexOutOfBoundsException: Index: 20, Size: 20