Skip to main content

This is documentation for Caché & Ensemble. See the InterSystems IRIS version of this content.

For information on migrating to InterSystems IRIS, see Why Migrate to InterSystems IRIS?

Saving the Form

Next, we add an event-handling function to PersonPage.cls that responds to clicks of the Save button. Such methods must be marked with the Language=JavaScript keyword and must be coded using JavaScript.

Add the following function to PersonPage.cls:

ClientMethod savePerson() [ Language = javascript ]
{
// validate and save form
var form = zenPage.getComponentById('personForm');
form.save();
var table=zenPage.getComponentById('personTable');
//refresh data in contact table
table.executeQuery();
}

This function performs two tasks:

  1. It invokes the form component's save method. This method invokes the dataController's save method which in turn uses the PersonModel %OnSaveSource and %OnStoreModel methods to save the form data to the database.

  2. It invokes the tablePane executeQuery method to refresh the tablePane data.

Note:

There are other options for saving the form data. For a summary of these options, read Saving the Form in the Zen QuickStart Tutorial.

For more in-depth information about forms, read Zen Forms in Using Zen Components.

Feedback