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...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Zen</strong> FormsAttributeOnLoadFormDescriptionName of a server-side callback method in the <strong>Zen</strong> page class. This method retrievesthe values that appear on the form when it first displays. It can get values from the objectwhose model ID is provided by the key attribute for the form, or it can assign literal values.The method must then place these values into the input array, subscripted by the nameattribute for the corresponding control on the form. It is this name (and not the id) thatassociates a control with a value. <strong>Zen</strong> invokes this method when it first draws the form,automatically passing it the following parameters:• %String — the key value for the form• An array of %String passed by referenceThe callback must return a %Status data type. The following example shows a validmethod signature and use of parameters:Method LoadForm(pKey As %String,ByRef pValues As %String) As %Status{Set emp = ##class(ZENDemo.Data.Employee).%OpenId(pKey)If ($IsObject(emp)) {Set pValues("ID") = emp.%Id()Set pValues("Name") = emp.NameSet pValues("SSN") = emp.SSN}Quit $$$OK}To use the above method as the callback, the developer would setOnLoadForm="LoadForm" for the or .onnotifyViewThis attribute applies if the form is associated with a data controller. The onnotifyViewvalue is a client-side JavaScript expression that is executed each time the data controllerconnected to this form raises an event. Generally this expression invokes a client-sideJavaScript method defined in the page class. This method becomes the “onnotifyViewevent handler” for the form. See the chapter “Model View Controller.”When providing a value for this attribute, use double quotes to enclose the value andsingle quotes (if needed) within the JavaScript expression. For example:The JavaScript expression may contain <strong>Zen</strong> #()# runtime expressions.onresetClient-side JavaScript expression that <strong>Zen</strong> invokes when this form is about to be reset.Generally this expression invokes a client-side JavaScript method.92 <strong>Using</strong> <strong>Zen</strong> <strong>Components</strong>

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

Saved successfully!

Ooh no, something went wrong!