Lotus Domino Release 5.0 A Developer’s Handbook phần 2 pps

71 523 0
Lotus Domino Release 5.0 A Developer’s Handbook phần 2 pps

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

continued YesNoRuns when the mouse is moved out of an ob j ect J avaScriptonMouseOut YesNoRuns when the mouse is moved J avaScriptonMouseMove YesNoRuns when a mouse button is pressed down J avaScriptonMouseDown YesYesRuns when document is bein g loaded. J avaScri p tonLoad YesNoRuns when a ke y is released J avaScri p tonKe y U p YesNoRuns when a ke y is p ressed J avaScri p tonKe y Press YesNoRuns when a ke y is p ressed down J avaScri p tonKe y Down IE only NoRuns when help is selected J avaScriptonHelp NoYesRuns when an object is selected with a double-click J avaScriptOnDblClick YesYesRunswhen an ob j ect is selected J avaScri p tonClick YesYesYou can put JavaScript functions in here. J avaScript J S Header YesYesThe frame pages, views and forms will open if no default frameset has been specified in the hotspot action p ro p erties FormulaTarget Frame YesYes Allows you to display your own help for a form when the user presses the F1 ke y . FormulaHelpRequest YesNoMust use the syntax: @Command([ToolsRunMacro]; “agentname”). You can also enter different types of formulas here without calling an agent. Tip You can enter a LotusScript agent and then call that a g ent. FormulaWebQuerySave YesNoRuns after a form is submitted from the Web. By default it runs an agent before a Web document displays. The formula must use the following syntax: @Command([ToolsRunMacro]; “agentname”). You can also enter different types of formulas here without calling an agent. Tip You can enter a LotusScript agent and then call that a g ent. FormulaWebQueryOpen WebNotesDescri p tionLan g ua g eEvents 54 Lotus Domino Release 5.0: A Developer’s Handbook NoYesRuns after the document is closed.LotusScriptTerminate NoYesRuns when a document is being loaded. LotusScriptInitialize NoYesRuns before a document is closed.LotusScri p tQuer y close NoYesRuns after the document has been saved. LotusScriptPostSave NoYesRuns before a document is savedLotusScri p tQuer y Save NoYesRuns after a document is refreshed (and values are recalculated). LotusScriptPostrecalc NoYesRuns after the user changes the document to Read or Edit mode. LotusScriptPostmodechange NoYesRuns before a document is changed to Read or Edit mode. LotusScriptQuerymodechange NoYesRuns after a document is o p ened.LotusScri p tPosto p en NoYesRuns before a document is o p ened.LotusScri p tQuer y o p en NoYesApplies to all scriptable objects and provides an area where all global variables are declared. LotusScript(Declarations) NoYesApplies to all scriptable objects and provides an area for statements (Use, O p tion, Const, Def). LotusScript(Options) YesYesRuns when a document is exited. J avaScri p tonUnload YesYesRuns when document is submitted. J avaScri p tonSubmit YesNoRuns when document is reset by b utton. Tri gg ers the form.reset.action. J avaScriptonReset YesNoRuns when a mouse button is released J avaScri p tonMouseU p YesNoRuns when the mouse is moved over an ob j ect J avaScriptonMouseOver WebNotesDescri p tionLan g ua g eEvents Note Whether an event is supported on the Web or not depends on the browser used. Please see the Domino R5 Designer help: “Table of supported JavaScript objects for automated components” for more information on which browser supports which events. Chapter 4: Forms 55 Creating a Field We will now take a look at how to create a field in a form. We will also see how to change the properties of the field. We will add a combobox field in the form. This field will demonstrate how to use keyword fields on the Web. The combobox field will allow you to choose one keyword. You will then change the color of the documents background on the Web. 1. From the standard navigator, choose Design, then Forms, and open the Main Document form listed in the view pane. 2. Type the static text, Background Color. 3. Next to the static text, create the field Color. To do so, choose Create - Field. Tip You can also display a pop-up menu by clicking the right mouse button and selecting Create Field. 4. On the InfoBox for Field, type a name for the field, for example, Color. The new name is now also shown in the Objects view. 5. In the Type field, choose Combobox. 6. In the field next to Type, leave Editable. 7. Enter 1 in the Tab field. This positions the cursor in this field when the document is opened. 8. Switch to the next tab. 9. In the Choices field, leave Enter choices (one per line). 10. In the Choices list box, type Yellow, Green and Blue. Separate the values by pressing ENTER . Note Remember to change the Frameset field in the forms InfoBox launch tab to -Blank 56 Lotus Domino Release 5.0: A Developer’s Handbook 11. In the Programmer’s Pane, leave the Default Value empty. The form and fields InfoBox should look like this: 12. Check that on the ParagraphHide When tab no checkbox is selected. 13. Save the modified form by pressing the ESC key, and confirm that you want to save the form. 14. Close the information box that is displayed. Performing a Test Run To test your modification from a Notes client: 1. Open a Notes Client and select the TeamRoom™ database. 2. Double-click the TeamRoom database in your workspace. Once the database is open, choose Create - Main Document. Chapter 4: Forms 57 3. In the document, you will see that there is now an additional field. The document will look like this: 4. Select a color for the background and type a document title in the Subject box. 5. Click the Save & Close button on the Action bar. To see the document, select the By Date view and the document will appear in the list of documents. To test your modifications from a Web browser interface, you can use the Preview in Web browser option in Notes, which will enable you to preview your form without creating a document. To do this, choose Design - Preview in Web browser. If your database is on a Domino Server, Notes will then use the browser specified in your location document to preview the form. If your database is on a local machine, Notes will start the Local Web Preview Process. Note You can only preview local databases which are in the Notes data directory. Alternatively you can do the following: 6. Start your Web browser. 58 Lotus Domino Release 5.0: A Developer’s Handbook 7. Enter the following command in the location field: http://"Server name"/Teamroom.nsf/Main+Document?OpenForm where Server name is the current server where the database is located, Teamroom.nsf is the database name and Main+Document?OpenForm opens the new document so that you can edit it. 8. You should see the new field in your browser. 9. Type in the Document title and choose the color for the background. 10. After you have completed the form, click Save & Close. Earlier we created a Color field to enable the user to change the background color of the form. We will now make some further updates to the form to add new functions: 11. From the Lotus Domino Designer R5.0, choose the Forms Design view. 12. Double-click the Main Document form in the View pane to open it. 13. Click the Color field. 14. Select the onChange event from the Objects view. 15. Type the following JavaScript code: document.bgColor=this.form.Color.options[this.form.Color.se lectedIndex].text OnChange event is a method which occurs when the value in the field is changed. The object document represents the current Web page, and it has a property bgcolor which is the background color of the page. this.form.Color.selectedIndex This returns an integer specifying the option selected in the field. Now that we know which of the options is selected, we can use it to return a text string with this.form.Color.options[this.form.Color.selectedIndex].text Chapter 4: Forms 59 16. After you have entered the code, the design should look like this: Caution Unlike HTML and LotusScript, JavaScript is case sensitive. 17. Preview the form in your browser. 18. When you select the value in the Color field, the background color of the page should change. Sharing and Reusing a Field You can only reuse fields in the database where the field has been defined as a shared field. 1. From Lotus Domino Designer R5.0, choose the Forms Design view. The list of forms is displayed in the view pane. 2. Double-click the Main Document form. The form is displayed. 3. Go to the Color field and select Design - Share this field. 4. Domino will automatically move that field to the Resources - Shared Field - View pane, where all database shared fields are stored. 5. In order to reuse the shared fields, choose the form where you want to add the field; for example, Event - Form. Choose Create - Insert Shared Field and a window will be displayed. 6. Select the Color and click OK. The field is now added into the form. 60 Lotus Domino Release 5.0: A Developer’s Handbook 7. Press the ESC key and save the form. Now the design should look like this: In this section we have only shown you how to create and run keyword fields, but all other fields work in a similar way. The following table lists the other field types and their explanations/declarations: continued Domino supports four-digit year format and, with R5.0, Domino can also display a 4 character year field. Using calendar controls, enable “Use Native Control.” Insert date and time in separate fields. Domino allows you to select different kinds of date and time formats. Time is date type. Field controls such as list b oxes, and calendar controls are available on forms. Date/Time You can resize the field by using the field properties InfoBox and selecting the Use native control in Basic tab and changing the width and height in Options tab. Web doesn’t support this option. The Designer can hide delimiters around the field by choosing the Hide Field Delimiter property. Normal text field, where user can enter text or numbers (if it is an editable field). Text can be string or variant type. Text Note Declarations F ield Type Chapter 4: Forms 61 Used for the Subscription feature. Provides a way to programmatically hold a formula that can be referred to b y some other process. Formula Matches Web functionality.Users can add text. Each character is displayed with an asterisk (*). Password The Choices option does not work on the Web. Security field which lets designers control form access. People, groups and servers who have been added in the field can open and read documents. Readers can be string or variant type. Readers The Choices option does not work on the Web. To help users enter names correctly in a document. Provides links to existing lists of names. Names The Choices option does not work on the Web. Security field which allows designers to control form access. People, groups and servers who have been added in the field can open and edit documents. Author can be string or variant type. Authors Field value can be stored in MIME format. Domino allows a user to add text, attachments, Java applets, tables in this field. Rich text can b e string or variant type. Rich Text These replace the keyword list fields in previous versions of Notes. By default the keyword list field type from R4 is automatically converted to the Dialoglist field type. These can be string or variant type. Combobox, Listbox, Dialoglist, Check box, Radio Button The Designer can change the decimal symbols by changing On display preferences to Custom. The Currency option lets you select the right country currency, or you can customize it. Number field can count imported values. Number can b e integer, float or double type. Number Note Declarations F ield Type 62 Lotus Domino Release 5.0: A Developer’s Handbook How keyword selections are displayed Combobox Note Width and height do not work on the Web. It formats to the width of the longest string. Listbox Note Width and height do not work on the Web. It formats to the width of the longest string. Radio Button Check box Dialog list Web Browser (IE 4.0)Notes ClientKeyword Note Choosing frame type has no effect on the Web. Field Properties Now that you have created a field, we are going to look at some of the properties of fields contained in the document form. Let’s first take a look at the Categories Field. We will look at the keyword field and explain the differences between this field type and other field types. Chapter 4: Forms 63 [...]... following page has been successfully submitted: "; REM "End variables to translate"; REM "Get the name of this database."; Chapter 4: Forms 71 The following formula gets the name of the current database, and replaces any spaces with the plus (+) character and replaces any backslash characters with the forward slash character (/) @DbName is a function which returns the name of the current Domino server and... browsers 82 Lotus Domino Release 5.0: A Developer’s Handbook Tables are especially useful for applications on the Web By using tables, you can be sure that fields are aligned correctly and that the images are positioned correctly With R5.0 you can include fields, graphics, buttons, subforms, hotspots, objects, sections, nested tables, attachments, Java Applets, and embedded elements inside a Domino table... creates a horizontal rule "Thank you for your document, "+@Name([CN];@UserName) +"! " 70 Lotus Domino Release 5.0: A Developer’s Handbook Note For the @Name function to work, you need to authenticate with the Domino server when first opening the database If you did, you would be classified as an Anonymous user of the application $$Return Example from TeamRoom Template The TeamRoom template... program file and enclose it in brackets Note that you can pass arguments, for example, values from fields in the form, to the CGI program Returning to Another Page You can display another Web page to the user once a form has been processed instead of leaving a blank, gray screen The following example displays the Lotus home page, but you can direct the user to the main view of the database instead,... to display the document Working With Layout Regions A layout region is generally used when creating dialog-like forms and in @Dialogboxes It consists of a 32- bit graphic that contains several kinds of design elements, such as fields (except for rich text, password and formula), static text and buttons However, Java applets, objects, attachments and embedded objects are not allowed Creating a Layout Region... separators • Security options: for example, Enable Encryption for this field Note Security options are not available for Web users 66 Lotus Domino Release 5.0: A Developer’s Handbook Fonts Tab The fourth tab of the InfoBox lets you specify fonts and colors for the field data The tab looks like this: Alignment Tab The fifth tab is the Alignment tab, which lets you specify the alignment of the paragraph... in the Programmer’s Pane In subforms, as in forms, @functions, LotusScript and JavaScript can be used 76 Lotus Domino Release 5.0: A Developer’s Handbook Note The subform does not contain the Default title, onSubmit, onReset, HTML Head Attributes, HTML Body Attributes, WebQueryOpen, WebQuerySave, OnHelpRequest events, because the subform is always linked to a form and the form already contains those... provides an area for statements (Use, option, Const, Def) No (Declarations) LotusScript Applies to all scriptable objects Yes and provides an area where all global variables are declared No Entering LotusScript When cursor enters a field Yes No Exiting LotusScript After cursor exits the field Yes No Initialize LotusScript When field is being loaded (user clicks the button, for example) Yes No Terminate LotusScript... users can make their selections In our example, a View variable is given the “MissionLookup” view name (which is later used in @DBColumn) and an @DbColumn formula checks all the documents in the current database for categories and retrieves them for display in a keyword list The Field Info tab also shows how the data is actually put into the field The following types of field are available: • Editable:... LotusScript, or JavaScript The following table lists all the Fields events: Events Language Description Notes Web Default value Formula When the document is loaded the contents of the Default Value event are displayed Yes Yes Input translations Formula Can be used to modify the data Yes entered by the user, to trim blanks, and to change users’ names into uppercase or propercase Yes Input validation Formula Requires . four-digit year format and, with R5 .0, Domino can also display a 4 character year field. Using calendar controls, enable “Use Native Control.” Insert date and time in separate fields. Domino allows. to all scriptable objects and provides an area where all global variables are declared. LotusScript(Declarations) NoYesApplies to all scriptable objects and provides an area for statements (Use, O p tion,. the name of this database."; Chapter 4: Forms 71 The following formula gets the name of the current database, and replaces any spaces with the plus (+) character and replaces any backslash

Ngày đăng: 08/08/2014, 18:22

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan