Domino Connection : Working with documents : VA Smalltalk document parts : Using the Domino Form part (AbtNotesFormPart)
Using the Domino Form part (AbtNotesFormPart)
The Domino Form part is used to model part of the properties of a form and allows you to handle documents as well. The Form part is flexible so you can add user defined fields to preexisting forms and documents. The form part is designed to support the execution of the three forms formulas: default value formula, input translation formula, and input validation formula. The default value formula is executed whenever a new document is created from the form part. Input translation and input validation are performed when the document is stored.
Setting up a Domino Form part
To explore the features of a form part, follow the example description below. Depending on the settings in your Organizer you will be prompted with either the notebook style settings pages (like in the example) or with the generic property list style window when you edit the part's settings. You will achieve similar results with both methods of configuring the part. If you cannot open the notebook style settings, you have to load the AbtEditNotesSettingsPagesApp using the Application Manager or the Organizer.
1. Create a new visual part from the Organizer window and name it DemoFormWindow.
2. In the Composition Editor drop a Domino Form part from the parts-palette on the free-form surface.
3. Open the settings page of the form part and select an appropriate connection to the sample discussion database. If you are not sure how to connect to the sample database, see Domino Connection specification on connecting a view part to the sample database.
4. Select MainTopic from the Form Name dropdown listbox and select the Automatic error reporter generation checkbox. After the connection is made, your form parts settings page General tab should look like this:
C:\Users\documentation\Documents\vastePublisher\stable\VAS Documentation Word\images\fpset.gif
5. Press the OK button to save the changes. Your Domino Form part is now set up to serve as an equivalent to the Main Topic form used by the Notes client.
6. Next tear off the currentNote attribute of the Form part and drop it on the free-form surface. This attribute represents a document being edited by the form.
7. Now select Quickform of self for the currentNote and place the results in your application window. The quick form feature will generate entry fields for all form elements available. Simple fields like text or date will be displayed in a single-line edit field, rich text fields are assigned to multi-line edit fields. A label will be generated for every field. Arrange the field to your convenience.
Your Composition Editor will look like this:
C:\Users\documentation\Documents\vastePublisher\stable\VAS Documentation Word\images\fpsmpl.gif
As the currentNote is associated to the form which defines the properties of the from part, all documents created and stored with the form part will be subjected to the execution of the forms formulas.
8. Now tear off the database attribute from the form part and drop it on the free-form surface. The database part is needed to synchronize the settings of your form part and the corresponding view part.
Integrating the Error Reporter part
As you selected the Automatic error reporter generation on the form parts settings page, you are now able to tear off another attribute: the error reporter. The error reporter part is designed to help you handle errors detected by low level functions of the VA Smalltalk Domino Connection.
The error reporter essentially supports one event (errorOccurred) and one attribute (lastError). It is common practice to connect the error reporter part with a message prompter part. Select a message prompter from the part palette and drop it on the free-form surface. Connect the prompt action of the message prompter to the errorOccured event of the error reporter and connect the lastError attribute of the error reporter to the messageString attribute of the prompter. You have now set up the form part's error reporter to display the error strings.
Your Composition Editor will now look like this:
C:\Users\documentation\Documents\vastePublisher\stable\VAS Documentation Word\images\fpsmpl2.gif
Promoting the features
Now switch to the part's Public Interface Editor and promote the following actions of the Form part: action editRow: and action editNote.
Save the part to make it available for future use.
Connecting the form to a view
The DemoFormWindow part you have built is capable of displaying and editing a document of the sample database delivered with the VA Smalltalk Domino Connection. You must now use the techniques learned in Using the view part to set up a view part and then connect the view to the form to compose a complete application.
Compose a view part to represent the By Category view of the sample database. Choose the visual representation of a view by using the viewTable tear off attribute. When you finish this task, you should have a window with a container tree view, a view part and a viewTable tear-off.
Add the DemoFormWindow part to the free-form surface. Use the Options menu from the Composition Editor and select Add Part. Type in the part name DemoFormWindow and select ViewWrapper as part type from the dialog box. The part will serve as "edit window" for appropriate documents.
You can connect the view part to the form part by selecting the Connect option from the view table part's popup menu. There will be a NOTE_ entry for every form defined in the database. The appropriate event will be triggered whenever you select a document from the view table.
Note:
The NOTE_ events generated automatically refer to the form definitions of the database. If you do not find any NOTE_ entries in the view tables event list, you may have not set up the view part properly. Check if the connection alias is set and if the "Available views" list in the view part's settings page is displaying any values.
There are two additional NOTE_ events: NOTE_Any and NOTE_Unknown. NOTE_Unknown is fired whenever a document is selected from the view and no form definition is available for this particular document. (This might happen when you copy documents between structurally different databases). NOTE_Any is always triggered when a document is selected from the view. Use NOTE_Any if you have a generic form on hand or if you want to make sure you open up all documents, no matter what form they are associated to.
Connect the NOTE_MainTopic event from the view table part with the editNote: action of the DemoForm part and with the openWidget action of the DemoForm part. This opens up your form window whenever a document that was saved with the form "Main Topic" is selected.
As you designed the form part to match the field description of a "Main Topic" note, it will not properly display response documents or documents with other internal structure. To inform the user that he/she might be about to edit a document with different field definitions, add a message prompter to the free-form surface. Connect the NOTE_Response event of the view part to the prompt action of the prompter.
Note:
You should connect all other unconnected NOTE_events to the prompter. For the sample, the NOTE_Response will do, because you know that there are no documents in the database other than MainTopic and Response. If you changed the contents of the database before, make sure you connect all necessary events to the prompter.
Save the part and run the application . Most of the documents from the view will be displayed in the DemoForm. If you try one of the response documents (which are second level category elements) the prompter will pop up.
Last modified date: 06/22/2018