Dialogbox - optional document - NoOKCancel

I looked at many, many posts about this and didn’t see my issue addressed, so sorry if I missed it…

I’m trying to use the DialogBox method in LotusScript, and I’m having some issues. I’m attempting to use a dialogbox in the most simple way, so I’m confused why this isn’t working. All I want - is to use the dialogbox and have my own OK & Cancel buttons.

The help docs say that having a doc parameter is optional, but it seems to be mandatory if I want to use the NoOKCancel options. I get the dreaded “Document must be selected…” error.

Can this be done without a background document?

More specifics about the issue…

I’m trying to use a button in a navigator to compose a document and have a dialogbox popup for required fields. I have error checking on my custom OK button that works. Click the OK button and data moves to like fields in the new document. Everything works perfectly if I use the Notes supplied OK button (without the NoOKCancel parameter)

got help ?

Subject: dialogbox - optional document - NoOKCancel

LotusScript doesn’t have a “:=” operator, so argumaents to any function have to be in order, and you can’t leave any out of the list between the first and the last one that you use. If you stop before doc, the code will assume the document currently open to the UI. If you continue beyond doc, then doc has to be a document actively in memory, whether it’s explicitly the ui document or a newly-created backend document. Entering nothing (two commas in a row, skipping doc), then you’ve effectively passed Nothing to the function.

Subject: RE: dialogbox - optional document - NoOKCancel

Thanks for coming to my rescue, once again Stan! So, you’re telling me it’s not possible without a backend document - right…?

I did try to create a backend doc with:

Set doc = db.CreateDocument

then I just before my Dialogbox line of code, I used:

Call ws.EditDocument(True,doc)

When I did this - I got the NoOKCancel option to work, but values from my dialogbox did not transfer to this new document. I tried ws.compose also and got the same results…

With Notes supplied OK buttons, I could use either compose or editdocument and got my values onto this newly created doc…

Here’s my code, although it really is simple:

Dim db As NotesDatabase

Dim s As New NotesSession

Dim ws As New NotesUIWorkspace



Dim doc As NotesDocument

Set db = s.CurrentDatabase	

Set doc = New NotesDocument(db)

’ Set doc = db.CreateDocument

doc.form = "MyNewDoc"

’ Call ws.ComposeDocument(“”,“”,doc)

Call ws.EditDocument(True,doc)	

Call ws.DialogBox("(Required)", True, True, True, True,False,False,"Required", doc, False, True, False)

I just get the feeling I’m doing something that is inherently wrong…

Subject: RE: dialogbox - optional document - NoOKCancel

Wish I could give you more, but I’ve reached the reached the end of file and wrapped; search term not found.

Subject: RE: dialogbox - optional document - NoOKCancel

You’ve got the NoNewFields parameter of DialogBox set to True. This means that fields on your dialog form which are not on the underlying form will not be passed (see help). Try changing this to false and see if it helps.

Emily.

Subject: RE: dialogbox - optional document - NoOKCancel

I can’t believe I missed that.

Subject: RE: dialogbox - optional document - NoOKCancel

I’ve been ‘got’ by it enough times to have learned my lesson :slight_smile:

Em.

Subject: RE: dialogbox - optional document - NoOKCancel

But, all the fields on my dialogbox ARE on my document and I want them all, to update…

Thinking about it this morning, it seems that, once I call ws.editdocument(true, doc) that my doc becomes a UIdoc… So following this logic I switched these two lines to call the document after the dialog…

Call ws.DialogBox(“(Required)”, True, True, True, False,False,False,“Required”, doc, False, True, False)

Call ws.EditDocument(True,doc)

then it worked… But I really wanted the new document UNDER the dialogbox and not the navigator from where it started… I guess this will have to do…!

thanks for your help guys!

jer