我有一个具有两个字段的表格,分别称为字段1"和字段2",还有一个动作按钮称为检查".在单击该操作按钮时,我想打开包含三个字段的对话框,这些字段将根据字段2的值自动填充.如何实现?
I have one form with two fields called "Field 1" and "Field 2" and one action button called "check". On click of that action button, i want to open dialog box with three fields which should get auto populate based on Field 2 value. How to achieve it?
感谢有人帮助我.
推荐答案是的,有可能. NotesUIWorkspace.DialogBox()有一个document参数.使用此文档可将参数传递给对话框.
Yes, it is possible. There's a document parameter for NotesUIWorkspace.DialogBox(). Use this document to pass parameters to your dialog.
更新
假设您有一个名称为"MyDialogForm"的表单来表示您的对话框.
Assume you have a form with name "MyDialogForm" to represent your dialog.
它看起来像这样,包含3个字段:
It looks like that and contains 3 fields:
您有一个包含两个字段和检查"按钮的表单:
And you have a form with two fields and "Check" button:
将以下代码放入检查"按钮的点击"事件处理程序中:
Put the following code to the "Click" event handler of your "Check" button:
Sub Click(Source As Button) Const DIALOG_FORM_NAME = "MyDialogForm" Dim ws As New NotesUIWorkspace Dim dialogBoxAccepted As Boolean Dim dialogParamDoc As NotesDocument Dim currentDocument As NotesDocument Dim field2Value As String Set currentDocument = ws.CurrentDocument.Document field2Value = currentDocument.GetItemValue("Field2")(0) 'document created in-memory, but should not be saved Set dialogParamDoc = New NotesDocument(currentDocument.ParentDatabase) 'populating dialog box fields Call dialogParamDoc.ReplaceItemValue("DialogField1", "dialogField1 with: " + field2Value) Call dialogParamDoc.ReplaceItemValue("DialogField2", "dialogField2 with: " + field2Value) Call dialogParamDoc.ReplaceItemValue("DialogField3", "dialogField3 with: " + field2Value) dialogBoxAccepted = ws.DialogBox(DIALOG_FORM_NAME,True , True, False, False , False , False, "My Dialog Title", dialogParamDoc, True) If dialogBoxAccepted Then 'displaying values, entered/changed in dialog box Msgbox dialogParamDoc.getItemValue("DialogField1")(0),,"DialogField1" Msgbox dialogParamDoc.getItemValue("DialogField2")(0),,"DialogField2" Msgbox dialogParamDoc.getItemValue("DialogField3")(0),,"DialogField3" End If End Sub此代码读取"Field2"并根据其值填充对话框字段.然后显示对话框,您可以在其中更改这些值.
This code reads "Field2" and populates dialog fields based on its value. Then it shows the dialog where you can change these values.
如果在对话框中按确定"(接受对话框),代码将显示您在对话框中更改的值.
If you pressed OK in your dialog (dialog accepted), the code will show the values you have altered in dialog box.
更多推荐
是否可以在Lotus Notes对话框中传递参数
发布评论