Resetting a form
We can redisplay a form page, resetting the form values to their initial values by using the pageName_Initialize method added to the WebApp by the Data Page builder call. The Data Page builder call adds this method when you use a Data Field Modifier builder call to set an initial value for one or more fields in the form.
To initialize a form perform the following steps:
- Add a Data Field Modifier builder call to your model for each of the fields for which you want set an initial value.
- In each Data Field Modifier call, set the Initial Value input.
- In the model action or Java code that reloads the form page, add a call to the pageName_Initialize method. For example, the following code could be used to re-initialize the form when a user clicks on a Reset button on the form:
public void resetForm(WebAppAccess webAppAccess) {
webAppAccess.callMethod("myFormPage_Initialize");
webAppAccess.processPage("myFormPage");
}