• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 193
  • Last Modified:

@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
0
Jaziar
Asked:
Jaziar
  • 3
  • 3
  • 2
2 Solutions
 
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.
0
 
Sjef BosmanGroupware ConsultantCommented:
I seem to remember it was more like @True and @False:

    @If(@DialogBox(....); ...; ...)
0
 
JaziarAuthor Commented:
Could you explain a little better sjef
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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)
0
 
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.
0
 
Sjef BosmanGroupware ConsultantCommented:
You missed the @Return in Marilyn's code.

@if(response = @False;@Return(@Prompt([Ok];"Nothing selected";"You need to select something"));"");
0
 
JaziarAuthor Commented:
You are correct
0
 
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.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

  • 3
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now