Issues w/the dialogboxcancel property

I have an action button in a view that calls a dialogbox…

I use the

flag = notesUIWorkspace.DialogBox( form$ , [autoHorzFit] , [autoVertFit] , [noCancel] , [noNewFields] , [noFieldUpdate] , [readOnly] , [title$] , [notesDocument] , [sizeToTable] , [noOkCancel] , [okCancelAtBottom] )

I create a tempDoc and use for the parameter [notesDocument] when I call the Dialogbox…

I wanted to put validation code in the Queryclose event of the dialogbox but of course I wanted to check first to see if the user had clicked the cancel button on the dialogbox by checking the dialogboxcancel property.

For some reason the source.dialogboxcancel property is being ignored in the query close… And my validation is being called and it won’t let me close the dialogbox w/out selecting values for the fields in the dialogbox.

Does it matter where you call the dialogbox from for the dialogboxcancel property to work…

Here is my code for the queryclose event…

If Source.DialogBoxCanceled Then

Continue = False

End If

If Source.Document.OldTextReaders(0) = “” Then

Messagebox “Please select the Change from value.”,16,“Required Field Selection”

Continue = False

End If

If I hit the cancel key, it still keeps checking to see if the OldTextReaders field has a value in it…

Any ideas on what I’m doing wrong?

Subject: Issues w/the dialogboxcancel property

Hi Betsy,

I think your problem here comes from a slight misunderstanding of the continue=false statement. As far as I am aware, this does not stop the code from continuing at that point. It tells Domino not to close the form, but not to stop the execution of the script. As such, you have two options for modifying your script.

  1. add an exit sub:

If Source.DialogBoxCanceled Then

Continue = True '** this needs to be true or the dialog box will never close even if the user presses cancel **

Exit Sub '** exit sub added here **

End If

If Source.Document.OldTextReaders(0) = “” Then

Messagebox “Please select the Change from value.”,16,“Required Field Selection”

Continue = False

End If

  1. Switch things round a bit like this:

If Not Source.IsDialogBoxCanceled Then

If Source.Document.OldTextReaders(0) = “” Then

Messagebox “Please select the Change from value.”,16,“Required Field Selection”

Continue = False

End If

End If

I haven’t actually tested this, but I think both the examples should work.

Please post back to let us know how you get on.

Emily.

Subject: RE: Issues w/the dialogboxcancel property

yes, that worked…

I switched it to continue = true

and then exit sub…

Thanks so much…