Home » Developer & Programmer » Forms » How to show the alert 'Do you want to save?' after entering each record. & Is there a way to sho
How to show the alert 'Do you want to save?' after entering each record. & Is there a way to sho [message #304698] Thu, 06 March 2008 03:58 Go to next message
astik.mondal
Messages: 14
Registered: March 2008
Location: Kolkata
Junior Member
Hi,

Is there a way to show the alert 'Do you want to save the changes you have made?', after entering each record.
i.e. as soon as a record is entered, user should be prompted to 'Do you want to save the changes?' the record when they move to the next record.

I used the below code in Post-Record rigger. Prompt was diplaying fine as per the requirement,but record was not saved.

DECLARE
n_button_selection INTEGER;
BEGIN
if :System.Record_Status='INSERT' then
fnd_message.set_string('Do you want to save the changes?');
n_button_selection := fnd_message.question('Yes', 'No','Cancel', 1, 2,'question');
IF n_button_selection = 1 THEN
forms_ddl('commit_FORM');
ELSIF n_button_selection = 2 THEN
RAISE form_trigger_failure;
ELSE
NULL;
END IF;
end if;
END;

I used forms_ddl('commit_FORM') to commit the record. Because we can't us Do-key('commit_form') in post-record trigger. But forms_ddl('commit_FORM') is not working. So can anybody please give some idea regarding this.


Regards,
AM
How to show the alert 'Do you want to save?' after entering each record. [message #304718 is a reply to message #304698] Thu, 06 March 2008 06:17 Go to previous messageGo to next message
astik.mondal
Messages: 14
Registered: March 2008
Location: Kolkata
Junior Member
Hi,

Is there a way to show the alert 'Do you want to save the changes you have made?', after entering each record.
i.e. as soon as a record is entered, user should be prompted to 'Do you want to save the changes?' the record when they move to the next record.

I used the below code in Post-Record rigger. Prompt was diplaying fine as per the requirement,but record was not being saved.

DECLARE
n_button_selection INTEGER;
BEGIN
if :System.Record_Status='INSERT' then
fnd_message.set_string('Do you want to save the changes?');
n_button_selection := fnd_message.question('Yes', 'No','Cancel', 1, 2,'question');
IF n_button_selection = 1 THEN
forms_ddl('commit_FORM');
ELSIF n_button_selection = 2 THEN
RAISE form_trigger_failure;
ELSE
NULL;
END IF;
end if;
END;

I used forms_ddl('commit_FORM') to commit the record. Because we can't us Do-key('commit_form') in post-record trigger. But forms_ddl('commit_FORM') is not working. So can anybody please give some idea regarding this.
Re: How to show the alert 'Do you want to save?' after entering each record. [message #304779 is a reply to message #304718] Thu, 06 March 2008 10:02 Go to previous messageGo to next message
Littlefoot
Messages: 20888
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Isn't that going to be very, VERY annoying? Where's the purpose of alerting users to commit (or not) every single record? If you want them to commit, do that unconditionally. If you don't want to take care about it but let users decide when to commit, let them do it.
Re: Is there a way to show the alert 'Do you want to save the changes?', after entering each record [message #304819 is a reply to message #304698] Thu, 06 March 2008 17:21 Go to previous messageGo to next message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
What made you think that 'commit_form' was a valid DML or DDL statement?

Use 'standard.commit' instead of the 'forms_ddl' command.

David
Re: How to show the alert 'Do you want to save?' after entering each record. [message #304823 is a reply to message #304718] Thu, 06 March 2008 17:31 Go to previous messageGo to next message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
Don't post the same question into a new thread just because no-one has answered your first question in 3 hours. This is a free site. We are not paid to answer questions.

David
Re: How to show the alert 'Do you want to save?' after entering each record. [message #304846 is a reply to message #304718] Thu, 06 March 2008 22:44 Go to previous messageGo to next message
azamkhan
Messages: 548
Registered: August 2005
Senior Member
Use WHEN-NEW-RECORD-INSTANCE and in this trigger check if the form or current block status is not NEW then issue COMMIT.

Regards,
Azam Khan
Re: How to show the alert 'Do you want to save?' after entering each record. [message #304969 is a reply to message #304846] Fri, 07 March 2008 06:10 Go to previous messageGo to next message
Flash
Messages: 34
Registered: February 2008
Member
Dude,

You've got it wrong.....

FORMS_DDL should be used only for DML/DDL statements.
COMMIT_FORM is a form procedure and not a DDL/DML statement.

So, in When-New-Record-Instance, check if the block status is NEW. If Not, then just apply COMMIT_FORM;

IF :SYSTEM.BLOCK_STATUS = 'CHANGED'
THEN
COMMIT_FORM;
END IF;

Should work for you.

Thanks
Flash
Re: How to show the alert 'Do you want to save?' after entering each record. [message #305061 is a reply to message #304969] Fri, 07 March 2008 22:18 Go to previous message
dbhossain
Messages: 155
Registered: August 2007
Location: Dhaka
Senior Member

WHEN-BUTTON-PRESSED:

BEGIN
SET_ALERT_PROPERTY('SAVE_REC',TITLE,'Save Record');
SET_ALERT_PROPERTY('SAVE_REC',ALERT_MESSAGE_TEXT,'Do you want to save the changes you have made?');

IF :SYSTEM.FORM_STATUS='CHANGED' THEN
IF SHOW_ALERT('SAVE_REC')=ALERT_BUTTON1 THEN
GO_BLOCK('BLOCK_NAME');
COMMIT_FORM;
ELSE
GO_BLOCK('BLOCK_NAME');
END IF;
END IF;

END;

Note: you have to create a alert named "SAVE_REC"
and set its type: CAUTION, Button 1 Label=Yes
Button 2 Label=NO

Thank you,
dbhossain
Previous Topic: Folder Functionality - Prompt not displaying
Next Topic: Open Form B From Form A within one session / Window
Goto Forum:
  


Current Time: Fri Dec 02 17:00:07 CST 2016

Total time taken to generate the page: 0.27092 seconds