once saved make the detail block read-only [message #653465] |
Wed, 06 July 2016 11:22  |
 |
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 #653490 is a reply to message #653474] |
Thu, 07 July 2016 03:13  |
cookiemonster
Messages: 13966 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.
|
|
|