AJAX events define an interaction sequence between a client and the server.
Typically, javascript will trigger the AJAX event which executes code and updates a region on the page.
For example, ticking a box might send data to the server, and depending on it's value, show or hide additional content on the page.
Any javascript event on an Oncord control can trigger an ajax event.
Just specify the native event name, suffixed by ajax.
For instance: onclickajax="..." and onchangeajax="...".
Attributes
id
string
Give this control a unique id. Can be accessed in the client DOM (eg, document.getElementById('myid') or in the server DOM using [? $myid ?] or [? $('myid') ?]).
showLoading
bool
Whether or not to show a loading message. Default = true.
updateRegions
string|array
Sets which ajax:region controls to refresh
Examples
Checkbox Show / Hide
Shows or hides a block of content based on a checkbox.
HTML:
<p>Tick the box below to see a block show or hide.</p>
<ajax:event id="showhide_checkbox_ajaxevent" updateregions="showhide_ajaxregion" />
<forms:form>
<forms:row label="Tick this box...">
<forms:checkbox id="showhide_checkbox" onclickajax="showhide_checkbox_ajaxevent" label="Click for More Options" />
</forms:row>
<ajax:region id="showhide_ajaxregion">
<logic:if test="$showhide_checkbox.checked">
<forms:row label="And then these options show...">
<forms:editbox id="moreoptions" />
</forms:row>
</logic:if>
</ajax:region>
<forms:row type="one_column">
<forms:submitbutton>Submit Enquiry</forms:submitbutton>
</forms:row>
</forms:form>