Welcome to MSDN Blogs Sign in | Join | Help

One more thing...

The Rabbit is muttering to itself, "Oh dear! Oh dear! I shall be late!", so I must press on.  So much to do.  I have to write about the Groove EDB Server next, and then Web Services, and start showing some (C#) Real Code.  I have a presentation the first week of August to cover the same ground I'm treading here and more, and this is thinking aloud.

But I can't leave Forms behind, at this early stage, without pointing toward the scripting features which make it a powerful application builder.  (You can't (yet) integrate managed code in the Groove Forms tool user interface.  But in case you're wondering, JavaScript is Real Code too, for all its faults).

Go back into the forms designer, to modify the Contact form.  (Either select "Modify Form -> Contact", or "Open Design Sandbox" then select the form in the design objects tree).

Then "create new field..."  and select "Script Button" field type.

Make three buttons. For the first, set the OnClick script to this:

alert( document.getElementById('FullName_Field').outerHTML );

There's a HTML input field on the form (in edit mode -- it's slightly different in preview mode) which is called "FullName_Field", because we have a field called "FullName"; this script reaches into the form's HTML and displays the contents of that piece of the form's structure.  So, hey, the form is a web page.  There are some helper functions (GetHTMLFieldValue etc) to get the current value out of an input field while in edit mode, and to set values directly into these fields; documentation in the Forms developer guide under "PublicScript Functions And Properties".

For the second, try this script:

alert( GetApp().CurrentAuthorName );

GetApp() is a helper function which gets you the Groove Forms UI Delegate (a COM component which implements IGrooveFormsToolUIDelegate) which has lots of really useful methods and properties.  For example, here, to retrieve the name of the current user.  Again, the developer guide (under GrooveFormsToolUIDelegate) has all the details.

For the third, this:

alert( GetFormRecord().OpenField("FullName") );

GetFormRecord() opens the current record (with a COM interface, IGrooveFormsToolRecord), from which you can read and write fields directly.  Note: these are different from the values displayed in the form:  if you make changes in the form, they aren't (usually) applied to the Record until you save changes.  But the record's always accessible, so if you really really want to read and write its values, you can do that at any time.

If there's a hierarchy of records, for example in a discussion (with "main topics" and "responses"), you can also use the Record interface to walk up and down the hierarchy.  For example, you might want to grab a field value from the topmost parent in a response hierarchy, to insert somewhere in the current form UI.

Enough rope to be dangerous.  Two take-aways from this little segment, though.

One: the user interface of a form is HTML -- it's actually an embedded Internet Explorer control -- and you can use all your favourite DHTML techniques on the form.  (There are lots of places to hook script into the form, and we'll cover them all in some detail, later...).  Some of our custom applications have used really sophisticated DHTML: expanding sections, hover animation, dynamic tables, popup menus, and so on.

Two: There's a big difference between the DHTML form (the "front-end") and the record which actually holds the data (the "back-end").  When you start to edit an existing record, the front-end form has its field values populated from the back-end record;  when you save, the front-end form pushes its values down into the back-end record; and in between, they are likely different.

Published Friday, July 22, 2005 1:49 PM by hpyle
Filed under:

Comments

# Furthur!

Friday, September 09, 2005 3:39 PM by hughpyle
Here's a recap and subject-index of the story so far.

Getting started with Groove Forms; the component...

# Furthur!

Friday, September 09, 2005 3:40 PM by hughpyle
Here's a recap and subject-index of the story so far.

Getting started with Groove Forms; the component...
Anonymous comments are disabled
 
Page view tracker