The FormElements collection is used as an emissary class to return information from plug-ins to Composite about form elements. The collention contains one or more FormElement objects.
Composite will use this information to render the form that the user gets.
Add - Adds a new FormElement to the
collection
Count - Returns the count of Elements
in the Collection
Item - Retrive an Item from the
Collection
ValidationCode - BSTR JScript
validation code for the collection
Data - The actual data of the
element
Label - The Label for the
Element
Type - The Type of the element as
defined by the enumeration struct of cpFormElement
CP_ENLIST_IN_TABLE - Element should
appear in the Table
CO_HIDDEN - Element should not appear
in the table
The example below creates a FormElements collection containg two form elements, a header and a imput field. A piece of validation code is also specified - this code will be executed by Composite when the user presses save.
Dim objTempForm As COMPOSITEEMISSARYLib.FormElement
Dim EditInfo As COMPOSITEEMISSARYLib.IcolFormElements
'' Create collection
Set EditInfo = New colFormElements
'' Set JavaScript to be executed befor the user can save
EditInfo.ValidationCode = "if (objForm.FetchURL.value = '') " & _
"{ blnReadyToSubmit=false; alert('Please specify the URL);}"
'' Create a form element
Set objTempForm = New FormElement
'' Create a heading (When Data is empty this is rendered as a heading)
objTempForm.Label = "URL Fetcher"
objTempForm.Type = CP_ENLIST_IN_TABLE
objTempForm.Data = ""
'' Add to collection
EditInfo.Add objTempForm
Set objTempForm = Nothing
Set objTempForm = New FormElement
objTempForm.Label = "URL to Fetch (http://www.somename.com)"
objTempForm.Type = CP_ENLIST_IN_TABLE
objTempForm.Data = "<INPUT TYPE=TEXT NAME='FetchURL' maxlength=1000>"
'' Add to collection
EditInfo.Add objTempForm
Set objTempForm = Nothing