Home » Developer & Programmer » Forms » once saved make the detail block read-only (10g)
once saved make the detail block read-only [message #653465] Wed, 06 July 2016 11:22 Go to next message
lucky123
Messages: 12
Registered: June 2016
Junior Member
Hello,

I have master and detail form.The requirement is to make details block readonly once it gets saved.

Once the user enter master record and corresponding child record and click save,the detail block should get freezed.User should not be able to make any changes like adding one more record to detail or updating existing record.When the data is query the detail block should only be read-only.

I wrote the below code in key commit trigger.But it did not work.Please suggest.

select count(*)
into v_count
from employees
where deptno = :employee.deptno;

v_count is to check records exist or not for master records.


if v_count<>0 then

set_item_property('blockname.item_name',update_allowed,property_false);
set_item_property('blockname.item_name',insert_allowed,property_false);

end if;





Re: once saved make the detail block read-only [message #653466 is a reply to message #653465] Wed, 06 July 2016 11:44 Go to previous messageGo to next message
Michel Cadot
Messages: 68625
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Please read How to use [code] tags and make your code easier to read.

Re: once saved make the detail block read-only [message #653472 is a reply to message #653465] Wed, 06 July 2016 14:47 Go to previous messageGo to next message
lucky123
Messages: 12
Registered: June 2016
Junior Member

DECLARE
v_count NUMBER;
BEGIN
select count(*)
into v_count
from employees
where deptno = :employee.deptno;

if v_count<>0 then
set_item_property('blockname.item_name',update_allowed,property_false);
set_item_property('blockname.item_name',insert_allowed,property_false);
end if;
END ;
Re: once saved make the detail block read-only [message #653473 is a reply to message #653472] Wed, 06 July 2016 14:49 Go to previous messageGo to next message
Michel Cadot
Messages: 68625
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Michel Cadot wrote on Wed, 06 July 2016 18:44

Please read How to use [code] tags and make your code easier to read.

Re: once saved make the detail block read-only [message #653474 is a reply to message #653473] Wed, 06 July 2016 14:56 Go to previous messageGo to next message
lucky123
Messages: 12
Registered: June 2016
Junior Member
DECLARE
 v_count NUMBER;
BEGIN
 select count(*)
 into v_count
 from employees
 where deptno = :employee.deptno;

 if v_count<>0 then
 set_item_property('blockname.item_name',update_allowed,property_false);
 set_item_property('blockname.item_name',insert_allowed,property_false);
 end if;
 END ;
Re: once saved make the detail block read-only [message #653490 is a reply to message #653474] Thu, 07 July 2016 03:13 Go to previous message
cookiemonster
Messages: 13917
Registered: September 2008
Location: Rainy Manchester
Senior Member
So set the block update_allowed property to false in the property palette and add some code to WNRI on the detail block to raise an error if they try to go to record that isn't number 1 - use :system.trigger_record.
Never use key-commit for anything - since you can save without firing it it's the most useless trigger.
Previous Topic: how to make a field readonly before saving
Next Topic: Forms 6i
Goto Forum:
  


Current Time: Fri Mar 29 08:29:02 CDT 2024