Home > Class Reference > ENSLIB namespace > %ZEN.Component.dynaForm
Private  Storage   

%ZEN.Component.dynaForm


class %ZEN.Component.dynaForm extends form

A dynaForm (dynamic form) is a specialized type of form that displays form whose controls are drawn automatically based on the contents of dataController associated with the form.
For example:

<dataController id="data" modelClass="ZENMVC.Person"/>
<dynaForm controllerId="data" injectControls="before">
<button caption="Save"/>
</dynaForm>
In this case, a form will be displayed with controls for each of the properties in the class ZENMVC.Person.
It is also possible to use dynaForm without a dataController. In this case you must provide an OnGetPropertyInfo server-side callback method to specify the list of controls to display.

Inventory


Parameters Properties Methods Queries Indices ForeignKeys Triggers
3 1


Summary


Properties
%condition %controller %import %includeFiles
%page %resource OnGetPropertyInfo OnLoadForm
OnSubmitForm action align autoValidate
autocomplete aux cellAlign cellSize
cellStyle cellVAlign children composite
containerStyle controller controllerId defaultGroupId
disabled dragEnabled dropEnabled enclosingClass
enclosingStyle enctype error groupClass
groupStyle height hidden hint
hintClass hintStyle id index
injectControls invalidMessage key label
labelClass labelDisabledClass labelPosition labelStyle
layout messageTargetId method name
nextPage noModelMessage onafterdrag onbeforedrag
onchange onclick ondefault ondrag
ondrop onhide oninvalid onnotifyView
onrefresh onreset onshow onsubmit
onupdate onvalidate parent propagateChanges
readOnlyMessage showLabel slice target
title tuple valign visible
width window

Methods
%AddChild %AddChildAfter %AddChildBefore %AddToSaveSet
%Attr %BindExport %ClassIsLatestVersion %ClassName
%ConstructClone %DispatchClassMethod %DispatchGetModified %DispatchGetProperty
%DispatchMethod %DispatchSetModified %DispatchSetMultidimProperty %DispatchSetProperty
%DrawComponentHTML %DrawHTML %DrawJSStrings %EnclosingDivId
%Eval %EvalC %Extends %ForceClientRender
%GetChildIndex %GetEventHandlers %GetParameter %GetXMLName
%IsA %IsModified %MakeId %New
%NormalizeObject %ObjectModified %OnAddToPageAfter %OnAddToPageBefore
%OnDrawEnclosingDiv %OnDrawForm %OnDrawObjectProperties %OnMutateChildren
%OnObjectSynch %OnZENDeserialize %OriginalNamespace %PackageName
%QuoteValue %QuoteValueL10N %RemoveChild %RemoveChildren
%RemoveFromSaveSet %Self %SerializeObject %SetModified
%ValidateObject ReloadForm XMLDTD XMLExport
XMLExportToStream XMLExportToString XMLNew XMLSchema
XMLSchemaNamespace XMLSchemaType addChild addChildAfter
addChildBefore childrenMutated clearModified dragFinishHandler
dragHandler dragNotifyHandler dragStartHandler dropHandler
dropStartHandler exposeComponent findElement fireOnUpdateEvent
getChildIndex getControlList getController getEnclosingDiv
getFormElement getHidden getHintElement getLabelElement
getProperty getSettings getType getValuesAsObject
invokeSuper isModified isOfType makeId
onCreate onDelete onDisplayHandler onEndModalHandler
onPopupAction onSerialize onStartModalHandler ondisabledHandler
onloadHandler onunloadHandler onupdateHandler refreshContents
reload removeChild render renderContents
renderSVG reset save sendEventToController
setControllerId setHidden setOverlayMode setProperty
setPropertyAll setValuesByName showMessage startProgressBar
stopProgressBar submit submitHandler validate


Properties


• property OnGetPropertyInfo as %ZEN.Datatype.delegator(FORMALSPEC="pIndex:%Integer,&pInfo:%String,pModelId:%String",RETURNTYPE="%Status");
(Optional) Name of Server-side callback method called just before dynamic components are injected into this form.
This callback method behaves in much the same way as the %OnGetPropertyInfo method of the %ZEN.DataModel.ObjectDataModel class. This must be the name of a server-only method in the page class that contains this form component.
For example:
Method GetInfo(pIndex As %Integer,ByRef pInfo As %String,pModelId As %String) As %Status
{
	// subscript of pInfo is the logical name of the control
	// the value of pInfo(name) is the sequence number (ordinal position of the control).
	// the value of pInfo(name,"%type") is the control type to display
	Set pInfo("Field1") = pIndex
	Set pInfo("Field1","%type") = "textarea"
	
	// the value of pInfo(name,"label") is the control label to display
	Set pInfo("Field2") = pIndex + 1
	Set pInfo("Field2","label") = "Field 2"
	Quit $$$OK
}
• property defaultGroupId as %ZEN.Datatype.id;
If defined, this is the id of a group within this form in which the dynamically created controls will be injected.
• property injectControls as %ZEN.Datatype.string(VALUELIST=",before,after") [ InitialExpression = "after" ];
Specifies where in the form the automatically created controls are placed relative to other controls that have been manually placed within the form:
  • "after" - (default) inject the automatically placed controls after any manually placed controls.
  • "before" - inject the automatically placed controls before any manually placed controls.
This is useful for cases where the dynaForm may define buttons and other controls in addition to those that are automatically created.
If defaultGroupId is defined, then this is ignored.

Methods


• method setProperty(property, value, value2) [ Language = javascript ]
Set the value of a named property.