12.07.2015 Views

Using Zen Components - InterSystems Documentation

Using Zen Components - InterSystems Documentation

Using Zen Components - InterSystems Documentation

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Providing Values for a FormAttributeOnSubmitFormDescriptionName of a server-side callback method in the <strong>Zen</strong> page class. This method takes a setof actions that is appropriate upon form submit. Use of OnSubmitForm is limited toproviding an alternative to the built-in mechanisms that a form provides for detectingchanges, validating values, and submitting the form. It should not be used to performother types of general-purpose processing.The next several sections describe the buildinmechanisms provided by form submit.<strong>Zen</strong> invokes this method when the user submits the form, automatically passing it aninput parameter of type %ZEN.Submit. If no OnSubmitForm value is specified for theform, <strong>Zen</strong> invokes the page’s %OnSubmit method instead. To follow this sequence,see the section “Processing a Form Submit.”The callback must return a %Status data type. The following is a valid signature for thiscallback:ClassMethod SubmitForm(pSubmit As %ZEN.Submit)As %StatusTo use the above method as the callback, the developer would setOnSubmitForm="SubmitForm" for the or .onsubmitonvalidatereadOnlyMessageClient-side JavaScript expression that <strong>Zen</strong> invokes when this form is about to besubmitted. Generally this expression invokes a client-side JavaScript method with aBoolean return value. Invoking this method gives <strong>Zen</strong> a chance to perform client-sidevalidation of values within the form. If the method returns false, the pending submitoperation will not occur. Note that unlike the HTML onsubmit event, the onsubmit callbackis always called whenever the form is submitted.Client-side JavaScript expression that <strong>Zen</strong> invokes when this form’s validate methodis called. Generally this expression invokes a client-side JavaScript method that performsvalidation.Message text that the form validate method displays in an alert box when the user makesan attempt to save a form bound to a read-only data model. The defaultreadOnlyMessage text is:This data is read only.Although you can enter ordinary text for this attribute, it has the underlying data type%ZEN.Datatype.caption. This makes it easy to localize its text into other languages, aslong as a language DOMAIN parameter is defined in the <strong>Zen</strong> page class. The%ZEN.Datatype.caption data type also enables you to use $$$Text macros when youassign values to the readOnlyMessage property from client-side or server-side code.4.4 Providing Values for a FormA form can initially display with blank fields, or you can provide data for some of the fields. Providing data for a field thatthe user sees means setting the value property for the associated <strong>Zen</strong> control component, before you ask <strong>Zen</strong> to display theform. There are several ways to do this:• Set the value attribute while adding each control to XData Contents.<strong>Using</strong> <strong>Zen</strong> <strong>Components</strong> 93

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!