Home » Developer & Programmer » Forms » Enable Insert button for 1 record only
Enable Insert button for 1 record only [message #581220] Wed, 03 April 2013 10:11 Go to next message
Messages: 36
Registered: June 2009
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
Messages: 21151
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.)
Previous Topic: text_items are not visible in runtime
Next Topic: Generate Query Result in oracle form 10g
Goto Forum:

Current Time: Wed Aug 23 12:47:31 CDT 2017

Total time taken to generate the page: 0.09049 seconds