Create an Attach File Button

Creating an Attach File button for an application provides the ability to insert files into the intended field. This routine prompts the user to select a file from the file finder and insert the file into the specified field.

How It Works

When the button is clicked, the cursor jumps to the specified field and launches the file finder. If the user selects a file, it is inserted in the specified field. In order to implement this solution, the target field must be set to Rich Text. Also note that the document must be in edit mode in order for the selected file to be applied to the designated field.

Note

You can also use Rich Text Lite, which by default will place a button next to the field.

 

Implementation

To implement this technique, create a Rich Text field on a form and make note of the field name. Next, create an action button and name it Attach File. To ensure that the button is only available when the document is in edit mode, set the "Hide When" properties for the button (see Figure 14.6).

Figure 14.6. Hide property settings for an action button

Finally, insert the following formula in the Programmer's pane. Replace FIELDNAME with the name of a Rich Text field on the form.

@Command([EditGotoField]; "FIELDNAME");
@Command([EditInsertFileAttachment])

Note

If the document is not in edit mode or there is no Rich Text field on the form, the error message shown in Figure 14.7 will most likely display.

Figure 14.7. Error when attempting to attach a file to a document in read mode


An Introduction to the Lotus Domino Tool Suite

Getting Started with Designer

Navigating the Domino Designer Workspace

Domino Design Elements

An Introduction to Formula Language

An Introduction to LotusScript

Fundamentals of a Notes Application

Calendar Applications

Collaborative Applications

Reference Library Applications

Workflow Applications

Web Applications

Design Enhancements Using LotusScript

Design Enhancements Using Formula Language

View Enhancements

Sample Agents

Miscellaneous Enhancements and Tips for Domino Databases

Data Management

Security

Application Deployment and Maintenance

Troubleshooting

Appendix A. Online Project Files and Sample Applications

Appendix B. IBM® Lotus® Notes® and Domino®Whats Next?



Lotus Notes Developer's Toolbox(c) Tips for Rapid and Successful Deployment
Lotus Notes Developers Toolbox: Tips for Rapid and Successful Deployment
ISBN: 0132214482
EAN: 2147483647
Year: N/A
Pages: 293
Authors: Mark Elliott

Flylib.com © 2008-2020.
If you may any questions please contact us: flylib@qtcs.net