Trigger to clear then set focus [message #628557] |
Wed, 26 November 2014 05:09 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
![](http://www.gravatar.com/avatar/5df9bc9df81b19a05b4b465aff47e5c6?s=64&d=mm&r=g) |
bezzy2829
Messages: 10 Registered: November 2014 Location: Sunderland
|
Junior Member |
|
|
I'm trying to make a button that has a trigger that will clear my form, then set focus to an item that is half way through the tab list. This is what I have:
begin
clear_form;
enter_query;
go_item('T_SURNAME');
end;
I cant figure out a way that I can get around it. If I don't put enter_query I cant select other items, but if I do put it, it seems to jump out of the code.
Also, when I press the button again, it sets the focus to the item, but I only want to press the button once.
Any help would be greatly appreciated. Thanks.
|
|
|
|
|
|
Re: Trigger to clear then set focus [message #628565 is a reply to message #628563] |
Wed, 26 November 2014 05:34 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
![](http://www.orafaq.com/forum/images/custom_avatars/72104.gif) |
Littlefoot
Messages: 21818 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
Actually, there is (but you fooled me with your code). The question doesn't say that you should enter query mode - it says clear the form. You don't use ENTER_QUERY to do that, you use CLEAR_FORM (as you already did). Then navigate to a desired item with GO_ITEM (specify a block along with the item name, if necessary).
[Updated on: Wed, 26 November 2014 05:35] Report message to a moderator
|
|
|
|
|
|
|
|
Re: Trigger to clear then set focus [message #628578 is a reply to message #628577] |
Wed, 26 November 2014 05:59 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
![](http://www.orafaq.com/forum/images/custom_avatars/72104.gif) |
Littlefoot
Messages: 21818 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
If user should enter it & you have to go to another item (placed behind the ID item), then you're in a dead loop. You should decide which of these is more important. Usually, you'd enter ID first (at least, that's "usual" for me).
You could do something like this (pseudocode) in the following triggers:
-- WHEN-BUTTON-PRESSED
set_item_property(id, required, false);
go_item(t_surname);
-- WHEN-VALIDATE-ITEM (on t_surname)
set_item_property(id, required, true);
[Updated on: Wed, 26 November 2014 05:59] Report message to a moderator
|
|
|
|
|
|
|
Re: Trigger to clear then set focus [message #628586 is a reply to message #628585] |
Wed, 26 November 2014 06:23 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
![](http://www.gravatar.com/avatar/5df9bc9df81b19a05b4b465aff47e5c6?s=64&d=mm&r=g) |
bezzy2829
Messages: 10 Registered: November 2014 Location: Sunderland
|
Junior Member |
|
|
This is the code in the button:
declare
begin
clear_form;
set_item_property('TENANT.TENANT_NO', REQUIRED, PROPERTY_FALSE);
go_item('T_SURNAME');
end;
This is the code in the WHEN-VALIDATE-ITEM (on t_surname) (Plus the code that was already there)
--
-- Begin default enforce data integrity constraint SYS_C0076702 section
--
set_item_property('TENANT.TENANT_NO', REQUIRED, PROPERTY_TRUE);
if not( :TENANT.T_SURNAME IS NOT NULL ) then
message( 'WHEN-VALIDATE-ITEM trigger failed on field - ' || :system.trigger_field );
raise form_trigger_failure;
end if;
--
-- End default enforce data integrity constraint SYS_C0076702 section
--
[Updated on: Wed, 26 November 2014 06:23] Report message to a moderator
|
|
|
|
|
|
|
|