Home » Developer & Programmer » Forms » How to get 'Do you want to save changes you have made?'
How to get 'Do you want to save changes you have made?' [message #609795] Wed, 12 March 2014 08:02 Go to next message
mist598
Messages: 905
Registered: February 2013
Location: Hyderabad
Senior Member
Hi all,

1)I have 2 blocks a)control b)EMP
2)I have only Button in the control Block and Table Block(Base Table) is EMP
if i click on the Button it displays the EMP Window shows the Records, if i update the existing rows and clicked on the save option then i want to show Alerts Like"'Do you want to save changes you have made?'

Code:
BEGIN 
    Go_block('EMP'); 
    
    execute_query; 
    
    IF :system.form_status = 'changed' THEN 
      COMMIT; 
      al_button := Show_alert('SAVE'); 

      IF al_button = alert_button1 THEN 
        Message('Do you want to save changes you have made?'); 
      END IF; 
    END IF; 
END; 


Name; SAVE
Message: Do you want to save changes you have made?
Alert Style: STOP
Button Label1: YES
Button Label2: NO
Button Label3: CANCEL

In the custom form i am not getting any Alerts(By Default) Please help.

If i click on YES Then save the existing row and if NO Then no commit

[Updated on: Wed, 12 March 2014 08:03]

Report message to a moderator

Re: How to get 'Do you want to save changes you have made?' [message #609798 is a reply to message #609795] Wed, 12 March 2014 08:22 Go to previous messageGo to next message
mist598
Messages: 905
Registered: February 2013
Location: Hyderabad
Senior Member
By Default it comes right? Yes i know ,but i want to update the existing row , here i wants to get Alert Messages like "Do you want to save changes you have made?" If yes then save the updated row,if NO then no commit.

Can any one please help me.

Oracle forms 10g
Re: How to get 'Do you want to save changes you have made?' [message #609801 is a reply to message #609798] Wed, 12 March 2014 08:30 Go to previous messageGo to next message
cookiemonster
Messages: 10929
Registered: September 2008
Location: Rainy Manchester
Senior Member
:system.form_status should never be changed after running execute_query. I'm not sure why you think it would be.
If you want to ask a user a question if they click on save then you would put code in key-commit.
Re: How to get 'Do you want to save changes you have made?' [message #609802 is a reply to message #609801] Wed, 12 March 2014 08:43 Go to previous messageGo to next message
mist598
Messages: 905
Registered: February 2013
Location: Hyderabad
Senior Member
Quote:
:system.form_status should never be changed after running execute_query. I'm not sure why you think it would be.
If you want to ask a user a question if they click on save then you would put code in key-commit.


Yes got it cookiemonster.. Smile

:system.form_status should never be changed after running execute_query
Yes you are right cookiemonster.. Smile



KEY-COMMIT Trigger
------------------
Declare
	al_button number;
Begin
   IF :System.Form_Status = 'CHANGED' THEN 
      al_button := Show_alert('SAVE'); 

      IF al_button = alert_button1 THEN 
        Commit_Form;  
      END IF; 
   END IF; 
End;


Thanks a lot... Smile
Re: How to get 'Do you want to save changes you have made?' [message #609803 is a reply to message #609801] Wed, 12 March 2014 08:46 Go to previous messageGo to next message
mist598
Messages: 905
Registered: February 2013
Location: Hyderabad
Senior Member
Hi cookiemonster i have another issue is if i wrote the below code in the on-commit,pre-update/pre-insert trigger how is is working? Can you please explain me please?
Re: How to get 'Do you want to save changes you have made?' [message #609804 is a reply to message #609803] Wed, 12 March 2014 08:52 Go to previous messageGo to next message
cookiemonster
Messages: 10929
Registered: September 2008
Location: Rainy Manchester
Senior Member
It won't work in the pre triggers, it isn't legal to use commit_form in them.
It'll work in on-commit but you'll end up getting asked if you want to save twice in some circumstances (exiting the form when there are uncommitted changes for example).
Just use key-commit
Re: How to get 'Do you want to save changes you have made?' [message #609805 is a reply to message #609804] Wed, 12 March 2014 08:55 Go to previous messageGo to next message
mist598
Messages: 905
Registered: February 2013
Location: Hyderabad
Senior Member
Quote:

It won't work in the pre triggers, it isn't legal to use commit_form in them.
It'll work in on-commit but you'll end up getting asked if you want to save twice in some circumstances (exiting the form when there are uncommitted changes for example).
Just use key-commit


Thank You cookiemonster.. Smile You are given more explanation on this Thanks a lot..you have more patience Thanks i like your patience... Smile
Re: How to get 'Do you want to save changes you have made?' [message #617386 is a reply to message #609805] Sat, 28 June 2014 06:35 Go to previous message
itech
Messages: 165
Registered: May 2008
Location: Fsd, Pakistan
Senior Member

I guess your problem is solved, however for future work and easy handling of forms 6i alerts / warning / stop (error) messages, we have made a pll library that can be found here : http://software.visititech.com/developer-tools/oracle-forms-6i-alerts-library/
Previous Topic: Error while appending data to a data block
Next Topic: Form Compilation error, 'Error 801 at line 1, column1' Internal error [hshuid:LU invalid]
Goto Forum:
  


Current Time: Mon Sep 01 03:26:23 CDT 2014

Total time taken to generate the page: 0.21883 seconds