docs.intersystems.com
MultiValue Quick Start Tutorial
Saving the Form
[Home] [Back] [Next]
InterSystems: The power behind what matters   
Search:    

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.


Send us comments on this page
Copyright © 1997-2019 InterSystems Corporation, Cambridge, MA