@dialog Issue

Here my code for a action button

@DialogBox( "Disc" ; [AutoHorzFit] : [AutoVertFit] ; "Editing Approval Work Flow" );
@SetField("Manager1"; discManager);
@SetField("ManagerA"; DiscManagerB);
@SetField("ManagerB"; DiscManagerC);
@SetField("ManagerC"; DiscManagerD);
@Command([RefreshHideFormulas] )

The problem is if the user hits cancel, all the manager fields on the form become null, works correctly if OK is hit
JaziarAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

marilyngCommented:
Add a response:

response := @Dialogbox(....);
@if(response = "";@Return(@Prompt([OK];"Nothing selected";"You need to select something"));"");
Then set your fields as you need to...

The @Return(""), will stop the code, and the Response will return the value selected.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Sjef BosmanGroupware ConsultantCommented:
I seem to remember it was more like @True and @False:

    @If(@DialogBox(....); ...; ...)
JaziarAuthor Commented:
Could you explain a little better sjef
JavaScript Best Practices

Save hours in development time and avoid common mistakes by learning the best practices to use for JavaScript.

Sjef BosmanGroupware ConsultantCommented:
Marilyn's code assumes that the return value from @DialogBox is a string value. AFAIK, @DialogBox returns @True (OK clicked) or @False (Cancel clicked)
JaziarAuthor Commented:
response := @DialogBox( "Disc" ; [AutoHorzFit] : [AutoVertFit] ; "Editing Approval Work Flow" );
@if(response = @False;@Prompt([Ok];"Nothing selected";"You need to select something");"");
@SetField("Manager1"; discManager);
@SetField("ManagerA"; DiscManagerB);
@SetField("ManagerB"; DiscManagerC);
@SetField("ManagerC"; DiscManagerD);
@Command([RefreshHideFormulas] )

Now it says "you need to select something" and still deletes the values on my main form .  If they hit cancel I want the box to close and not change any of the fields on the main form.
Sjef BosmanGroupware ConsultantCommented:
You missed the @Return in Marilyn's code.

@if(response = @False;@Return(@Prompt([Ok];"Nothing selected";"You need to select something"));"");
JaziarAuthor Commented:
You are correct
marilyngCommented:
Thanks, sjef for the catch, I was concentrating on the @Return, and somehow had " @Prompt([OKCANCELLIST])..." in my head, rather than a dialog box.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Lotus IBM

From novice to tech pro — start learning today.