Genii Weblog


Civility in critiquing the ideas of others is no vice. Rudeness in defending your own ideas is no virtue.


Wed 19 Nov 2003, 03:59 PM
Continuing the customer inspired list of the top ten ways to use Midas which I started a couple of days ago with  #10) Rich text comparisons with red-lining, and continued yesterday with #9 Manage doclinks, URL links and link hotspots, I now offer #8...


#8) Build dynamic forms

Description
Midas empowers the developer who wants to go "a bit farther" by giving access to design elements such as forms, subforms, pages, image resources and shared fields.  In particular, the power to create and manipulate forms is a key to building truly dynamic applications.  All of the more "normal" functionality in Midas comes into play, so fields can be created inside tables, or embedded views added in layers, or upload controls added for a web form, or a table with a set of related fields in one row can be extrapolated to have each matching field copied to additional rows and keep the relationship between them. It is even possible to store a form in a document and then modify it there, customizing each document to its exact purpose. 

History
Midas was originally created for and intended for use with rich text fields, but as more users saw the possibilities, more started asking for extensions to allow form manipulation, since forms are "just more rich text".  After developing a model that would make it easy to work with the very complex attributes and formulas associated with design fields, we added the option to work with forms in Version 2.00 in September, 1999.  Many enhancements have been added since, including the ability to work with related design elements, and enhancements continue to be made to ensure that Midas makes form creation and manipulation as easy as creating and manipulating any other rich text.

Comparison with standard Notes/Domino functionality
Notes 6.x has incorporated some ability to create design elements using DXL, which can be exported and re-imported, but the ease of use is very low, given the need to understand XML parsing as well as the somewhat arcane DXL format.  Even the simplest change to a field would require exporting and modifying the entire form, and the ability to store and manipulate forms stored in documents is not supported.  Other than this DXL approach, there is no support in the standard Notes classes for any forms manipulation at all.

Documentation
Documented in the Help database by looking at the properties, methods and events associated with creating and modifying fields, including the AppendField method and UserModifyField method, as well as the use of many other methods and properties which relate to other rich text which might go on a form, such as the AppendTable method, the  AppendLayer method, the AppendResource method for adding image resources, the AppendHotspot method for adding embedded elements such as upload controls, subforms, embedded views, etc.  There is also a Working with fields and design elements article under 02 Reference Guide/02 Working With/Working with fields and design elements.

On-line demo
Create Form Dynamically: A very simple demonstration of creating a form with fields.

Sample Database
Form Design (Notes client) Forms/Fields
This sample shows some of the design possibilities, including creating a new form that extrapolates fields from an old form, and manipulating a stored form.
Sample Script Snippet
This is taken from a sample created for a customer:

' *** Set up an entering and exiting script for a new field, showing the long and short form
rtchunk.EventRetString1 = |LotusScript:Entering:Dim ws as New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
Set uidoc = ws.CurrentDocument
Set doc = uidoc.Document
Print "Universal ID is " & doc.UniversalID|

rtchunk.EventRetString2 = |LotusScript:Exiting:Print "You are in the exiting event"|
rtchunk.EventRetShort1 = 2
Call rtchunk.AppendField("Subject", "Text", "Editable", "", |@If(Subject=""; @Failure("Subject is required"); @Success)|)

' *** Skip the entering and exiting scripts by re-setting the EventRetShort1 field to 0, and add another field
rtchunk.EventRetShort1 = 0
Call rtchunk.AppendField("Body", "Rich Text", "Editable")

Copyright © 2003 Genii Software Ltd.