Show navigation | Frontpage | Contact us | Sitemap

FormElements

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.

colFormElements (Collection of FormElements):

  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


FormElement: Containment class for the communicated elements

  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

cpFormElement: (Global defined enumeration constants)

  CP_ENLIST_IN_TABLE - Element should appear in the Table
  CO_HIDDEN - Element should not appear in the table

Visual Basic Example:

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

My modules


© 2008 Composite A/S, Danmark
Tlf: +45 39 15 76 00 | info@composite.net
Composite A/S er Microsoft Certified Partner
Composite CMS overholder standarden for valid CSS
Composite CMS overholder standarden for valid XHTML 1.0
Printet fra http://www.composite.net/composite-123.htm
Findes på denne sti: Composite Developer | 3.x technologies | Configuration | Developing COM plug-ins | FormElements