Some pages may show a group of properties for an item, with an "apply" and "cancel" buttons. If the user hits "Apply" then any edits made to properties are saved. If they hit cancel, any changes are cancelled out.

In Jitsu, you can use submitters to achieve this effect.

To use a submitter, you first add a Submitter helper object to the page using:

        <j:Submitter submitterId="sub1"/>
    

Basic input controls (TextBox, ComboBox, etc) support a "submitterId" property. Here we set it to "sub1":

        <j:TextBox text="#bind(item.name)" submitterId="sub1"/>
    

If submitterId is set, the control searches for that submitter in its parent controls. The matching submitter is used to coordinate data submission.

(If you name a submitter that doesn't exist, you should see an error in the Jitsu Inspector).

Many controls can share the same submitter. In our example, all of our controls are using the submitter "sub1".

When a control's submitterId property is defined, any of the control's bound properties use a special "copy-on-write" behavior: when the control needs to modify the bound property, it first makes a copy of the bound value, and then makes modifications to that local copy - the global version of the value on the page does not change. Edits only effect the local copy.

There are two methods associated with submitters: submitChanges and cancelChanges. When you invoke "submitChanges", any local edits that controls have made are pushed out to their respective datasets. When you invoke cancelChanges, any local values are discarded, and the controls reset their properties to show the global page value.

The easiest way to invoke submitChanges or cancelChanges is to use a button, e.g.

        <j:Button click="sender.submitChanges(ID_sub1)"/>
        <j:Button click="sender.cancelChanges(ID_sub1)" />