Allowing users to edit or create documents from a view
About this task
You can give Notes® users the ability to edit fields in an existing document or create a new document from a view. For example, you might use this feature in a ToDo view to change a work item from Incomplete to Complete. The Domino® mail template uses this feature to allow you to enter an appointment into your calendar from the calendar view.
Usage Notes®
About this task
- InViewEdit events will work for embedded views as long as the "Selection tracks mouse movement" is not checked on the Display tab of the Embedded View Properties box. InViewEdit events are not triggered in an embedded view if this feature is enabled.
- This feature is not supported in views from another database that are embedded in a rich text field. For example, trying to create or edit a document in a view from a discussion database embedded in a mail message results in an error.
- The InViewEdit event works for folders as well as for views. However,
if a user presses Ctrl-Click to create a new document in a folder,
the new document is created, but is not put into the folder. Instead,
it will appear in views for which it meets the selection criteria.
As with other cases, the document must be explicitly dragged, moved,
or added to the folder.Note: Users will be prompted to Ctrl-Click to create a document when there is at least one document already in the view. If the Ctrl-Click line on a view is not entirely visible, and there is no vertical scrollbar to scroll down further, users can press Ctrl-End to make it more visible.
To allow users to edit documents in a view
About this task
To let users edit an existing document without first opening the document, you must first identify the columns containing user-editable fields. Then you must supply code that controls what a user can do when editing the associated field. You can mark more than one column as editable. For each column you want to allow the user to edit:
Procedure
- Select the column that will display the editable field.
- Choose Design - Column Properties.
- Check "Editable column" on the Info tab (i) of the Column Properties box.
- Click the Inviewedit event in the View objects list in the Programmer's pane.
- Enter code to control what should happen when a user edits the field, as described in the programming topic InViewEdit event.
To allow users to create a new document from a view
Procedure
- Select the view from which users can create new documents.
- Choose Design - View Properties.
- Check "Create new documents at view level" on the Info tab (i) of the View Properties box.
- Click the Inviewedit event in the View objects list in the Programmer's pane.
- Enter code to create the new document, set the form value and to check and validate entries for the new document, as described in the programming topic InViewEdit event.
Coding notes
About this task
- There is only one InViewEdit event per view. The event is called multiple times for each edit and uses a parameter called RequestType to determine whether Notes® should be providing default information, validating data, or saving changes to documents in the view.
- More than one column can be marked as user-editable.
- Use the programmatic name as set in the Advanced tab of the Column Properties box as the name of the field that gets updated when the column is edited. This will make coding the InViewEdit event easier to identify the column you are marking as editable.
- Code the RequestType parameter with a value of 4 to handle document creation.
For a complete description of how to code the InVewEdit event, see the topic InViewEdit event.