Custom messages to the XForms Hosting Environment

Release 2.0 - ...

The Smartsite XForms Engine supports sending custom messages to the host. This mechanism can be used to pass information to the environment in which the engine is embedded, during XForms runtime.

In order to send messages to the XForms hosting environment, you must declare a namespace in your document:

HTML CopyCode image Copy Code
<html [...] 
 xmlns:exh="http://smartsite.nl/namespaces/xforms/1.0"
>

Then, you can send messages by using the given prefix in the level attribute of your message:

HTML CopyCode image Copy Code
<xf:trigger ref="state/next">
   <xf:label>Next</xf:label>
   <xf:action ev:event="DOMActivate">
      <xf:toggle id="case3" />
      <xf:message level="exh:persist-state" />
   </xf:action>
</xf:trigger>

In the example shown, the hosting environment is asked to store the current state of the XForms session. In the Smartsite CMS, this will lead to storing the state in the XFormsState database table for later usage.