It's still send e-mail when a press cancel?

I use this in a button.

First a open Names and pick one person, then a open a new window (Dialogbox). If a press cancel there it’s still send away the e-mail. Where did a wrong?

subject:="Changenumber: " + ChangeNumberSum;

body:="Follow the link. => ";

sendto:=@PickList([Name]);

form := “DlgComments1Email”;

title := “Description of and cause for change - Comments and notify!”;

FIELD Notify1:=“Notify e-mail to “+ @Name([CN];sendto)+”.”;

FIELD TempField1 := CommentField1;

@DialogBox( form ; [AutoHorzFit] : [AutoVertFit]:[NoNewFields] ; title );

FIELD CommentField1:= TempField1;

@Command([ViewRefreshFields]);

FIELD Notify1:=“”;

@MailSend(sendto;“”;“”;subject;“”;body;[IncludeDoclink]);

Kind regards

Fredrik

Subject: It’s still send e-mail when a press cancel?

Canceling the dialog box does not cancel the rest of your formula, so the message will still be sent. There are many ways to approach this; here are a couple:

  1. Write the code in lotusscript, and use uidoc.dialogboxcanceled to tell if the user canceled.

  2. Add your own Ok and Cancel buttons to the dialog box, and have the Ok button do the @mailsend.

HTH!