Jump to content

How do I make dialog cancel script?


This topic is 2847 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hi-

I've added a 'show dialog' script step to a script. When testing the dialog I find that both the OK and Cancel buttons allow the script to continue.

 

I want the 'cancel' button in the dialog to cancel the rest of the script and revert the field, but I can't find how to do this. Checking and unchecking the 'commit data' boxes in the Dialog setup doesn't seem to do the trick.

 

Any help appreciated.

 

Thanks

 

Link to comment
Share on other sites

Thanks for the quick reply, doughemi-

 

I tried inserting an 'If/End If' condition after the custom dialog step, but the [Get(LastMessageChoice) = 2] option doesn't seem to be available as a script step. How do I insert that function into the script?

 

post-71326-0-02618800-1423577145_thumb.j

Link to comment
Share on other sites

"want the 'cancel' button in the dialog to cancel the rest of the script and revert the field,"

 

You may wish to design the UI using a popover with global fields instead. In that way, the user must click an OK in order for the edited value to be committed to the record. If you are really using FM12, then use a modal window.

Link to comment
Share on other sites

In the Specify Calculation dialog, select Get Functions in the View dropdown.

post-75181-0-90216100-1423580015_thumb.p

However, I missed the part about reverting the field.  Barbara's answer is the correct one.  Otherwise, there is no easy way to save the original value to reinsert into the field.

 

 

Link to comment
Share on other sites

I want the 'cancel' button in the dialog to cancel the rest of the script and revert the field

 

What exactly does "revert the field" mean in this context? Going by your screenshot, you actually want to clear a field - not revert it to some previous value it might have had. Which should be really easy to do as:

...
If [ Get  ( LastMessageChoice ) = 2 ]
  Set Field [ YourTable::SomeField ; "" ]
  ...
End If
...

Moreover, since it appears that the field is actually populated by the same script, you may streamline the process by asking first, shooting later:

Show Custom Dialog [ Message: "Are you sure ...?"; Buttons: “OK”, “Cancel” ]
If [ Get ( LastMessageChoice ) = 1 ]
  Set Field [ YourTable::SomeField; Get ( CurrentDate ) ]
  Commit Records/Requests
End If

Note: you should (almost) always use Set Field to populate fields, rather than Clear or Insert Calculated Result.

Link to comment
Share on other sites

This topic is 2847 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.