Enable Insert button for 1 record only [message #581220] |
Wed, 03 April 2013 10:11 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
cornwall
Messages: 36 Registered: June 2009
|
Member |
|
|
I have a form with a block at header level. Once you save your header, there is a second block at line level.
I want to be able to enter only one record at header level and line-level.
Also if you search on an instance which already has a record at line-level then i want the insert button to be greyed out.
Similarly once you create your first record at line-level the Insert button should be greyed out.
How can this be acheived?
|
|
|
Re: Enable Insert button for 1 record only [message #581245 is a reply to message #581220] |
Wed, 03 April 2013 13:24 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) |
![](/forum/images/custom_avatars/72104.gif) |
Littlefoot
Messages: 21823 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
I don't have Forms here so I can't test it myself, but - here's an idea: create a WHEN-NEW-RECORD-INSTANCE (or, possibly, WHEN-CREATE-RECORD) form-level trigger (why not block-level? Because you want it to affect the whole form, both blocks. You could, of course, create one trigger per block, but - why would you?).
Put something like this in there:
if :system.trigger_record > 1 then
message('One record only');
raise form_trigger_failure;
end if;
(I'm not sure that you can disable Forms toolbar's "insert" button.)
|
|
|