Prevent a Form from Closing after 'OK'

millsmik

Member
Prevent a Form from Closing after \'OK\'

Using FDA, does anyone know how to prevent a form in update mode from closing after the user clicks the 'OK' button?

Thanks!
==========
XE, SP23_J1, Power 5 (DB2)
 
Re: Prevent a Form from Closing after \'OK\'

You can use form properites and under options click off End Form on Add
 
Re: Prevent a Form from Closing after \'OK\'

Thank you for replying Jeremy. I looked at that before and it is not checked. The Oracle user guide says that in update mode OK closes the form. If I make changes on my fat client to form properties, the change should be dynamic, correct?
 
Re: Prevent a Form from Closing after \'OK\'

Hi,

Yes you are right, it closes the form during update regardless of whether it is on/off. I would suggest that you code your own OK button and determine when you want to close the form by using the press button command.
 
Re: Prevent a Form from Closing after \'OK\'

Hi millsmik,

You didn't mention, what type of form have you trouble with.

Maybe the key event for Fix/Inspect is the Update Record DB After, for Headerless/Detail is one of the All Record* events.

If you issue an error in this event, the OK won't be return.
I recently figured out this solution for one of our clients.

It was a Headerless/Detail without Add and Delete functionalty, and used the All Grid Recs Updated event. I still have not tested this on Fix/Inspect.

In my solution, if there is no error on the form, then issue an error for a dummy hidden control and Press Button(HC Find).
In the Button Clicked event of the Find, I clear this error on the dummy control, so it is invisible for the user.

The safest way, to add a dummy, hidden control which hasn't any attached validation - to hold the error temporaly, instead of using an already existing one for this purpose, which maybe has its own error handling, validation in the application.

If you don't want this OK/Find combination, then:

1.) Disable the OK.
2.) Create your own "OK" (Hyper Control or Push Button).
3.) Call the OK from your own OK.
4.) Set the error in one of the previously metioned event.
5.) Clear the error in your own "OK" after you called the "real" OK.

Please, let us know, does it a solution for you?

Regards,

Zoltán
 
Re: Prevent a Form from Closing after \'OK\'

Hi,

IMPORTANT NOTE to the previously described solution:

The Post Button Clicked event of the "real" OK Button won't be executed!!!

If you have any logic on this event, then this requires special considaration and/or solution.

Excuse me, that I missed to add to my previous reply.

Regards,

Zoltán
 
Re: Prevent a Form from Closing after \'OK\'

Thank you Zoltan! Yes, I have a headerless detail form and all logic is on the Post Button Clicked event of the OK button. I am a rookie developer but think I understand your logic. I will play around with this and let you know if I am successful.

Mike.
 
Re: Prevent a Form from Closing after \'OK\'

Thanks for getting back to us, Matt.
confused.gif


To validate Zoltan's wonderful advice, it works perfectly for my Headerless Detail form. Now, try documenting *that* craziness in the NER...

To summarize the working solution:

1) I "disable" the original OK button to hide it
2) I create a Push Button that sets Errors and/or Warnings. At the end of the Push Button Clicked event:
a. Push Button(OK Button)
b. Clear Bogus Control Error
3) My OK Button Clicked event has one line: Push Button(Hidden Go Process DB Button)
4) "Hidden Go Process DB" Push Button does several DB inserts. The last line of the event throws the bogus control error.
5) Because control error is set, OK Button does not quit app. Processing returns back to step 2b, which immediately (invisibly) clears the control error.

My app continues to run. I get to leverage built in form validation. I don't have to code for 1st Time Warnings by hand. Perfect!

Zoltan, you're the man!
cool.gif
 
Re: Prevent a Form from Closing after \'OK\'

I know this is a little late, but just read through this entire thread. To his credit, Zoltan knows his stuff. However, he is still on Xe as far as I know. If so, he would not know about the new system function "Set Save Behavior On OK". I have used this before to keep a form from closing when clicking on ok. It would certainly be less confusing if it would work in your case.
 
Re: Prevent a Form from Closing after \'OK\'

Hi Scott,
On our Apps 9.0 / Tools 8.98.3.1 the functions for "Set Save Behavior on OK" were not working for me. I tried just about every other potentially related function listed in the FDA manual before resorting to Google and finding this thread.

One "Lesson Learned" for me in this app is to try and design your apps to leverage the "natural" flow of FDA apps. Avoid building complex forms that go against the grain that JDE intends you to use. Then you don't have to work on hacks like this to make things work.

Had I just used "OK" button to do all of the work to begin with, I would be in a much better situation.
 
This reply might be late but i hope this helps those who refer this issue from now.
In case of Headerless Detail,Add the system function "Set Save behaviour on OK " and set it to "save and continue" in the Post dialog initialised event of the form as well as button clicked event of the OK button.

My tools:9.2.4.3

Thanks,
Vasanth.
 
Thank you for this very helpful update on this topic Vasanth. It is helpful after all to read through the comments completely to the end. Even though the original thread is already over 8 years old, someone keeps stumbling upon this problem. Thumbs up!
 
Yep, same here. I always forget this one. many thanks!

In case of Headerless Detail,Add the system function "Set Save behaviour on OK " and set it to "save and continue" in the Post dialog initialised event of the form as well as button clicked event of the OK button.
 
Yep, same here. I always forget this one. many thanks!

In case of Headerless Detail,Add the system function "Set Save behaviour on OK " and set it to "save and continue" in the Post dialog initialised event of the form as well as button clicked event of the OK button.
 
Back
Top