Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Set focus (cursor) to a specific Textbox 1

Status
Not open for further replies.

tpbjr

MIS
Oct 8, 2004
120
US
Hi,

I am popping up an aleart then after the user clicks the ok button I want focus to go to a specific text box but I am not having any luck! This is Oracle form developer version 6.5

I appreciate any help.
Thank you for all your help



Thank you for all your help

Tom
 
Have you added a
Code:
GO_ITEM(field_name);
after your code to issue the alert? It must be positioned before any
Code:
RAISE FORM_TRIGGER_FAILURE;

[sup]Beware of false knowledge; it is more dangerous than ignorance.[/sup][sup] ~George Bernard Shaw[/sup]
Consultant Developer/Analyst Oracle, Forms, Reports & PL/SQL (Windows)
Author and Sole Proprietor of: Emu Products Plus
 
Well--it partially works.

If I am on another object such as a LOV or different text box then the go_item command works. But if the cursor is in :blk_rpt_parm.journal_type and I issue the go_item('blk_rpt_parm.journal_type') command I get the following error.

FRM40737 - Illegal restricted procedure GO_ITEM in WHEN-VALID-ITEM trigger.

Basically, if call the following function while the cursor is not in the :blk_rpt_parm.journal_type text box, it works, but if the cursor is in side the :blk_rpt_parm.journal_type text box it gives the FRM40737 error.


FUNCTION LaborRelated RETURN BOOLEAN IS
BEGIN

if :blk_rpt_parm.journal_type in ('LU','LO','LT','LF','LA','LR')
then
:journal_desc := null;
:blk_rpt_parm.journal_type := null;
if show_alert('alert_report_disabled')= alert_button1 then
go_item('journal_type');
return true;
end if;
end if;
return false;

END;




Thank you for all your help

Tom
 
Ok, here is what I came up with and it works, but if you have a cleaner way to do the same thing I would appreciate your input.

I call the function and pass it true or false. I pass it true if I am calling it from the textbox that has the current focus and I want focus to stay there if labor is detected. If the cursor is in any other location I call the function with false.


FUNCTION LaborRelated (NoGOITEM BOOLEAN) RETURN BOOLEAN IS
BEGIN

if :blk_rpt_parm.journal_type in ('LU','LO','LT','LF','LA','LR')
then
:blk_rpt_parm.journal_desc := null;
:blk_rpt_parm.journal_type := null;
if show_alert('alert_report_disabled')= alert_button1 then
if NoGoItem
then
RAISE Form_Trigger_Failure;
else
go_item('journal_type');
end if;
return true;
end if;
end if;
return false;

END;

Thank you for all your help

Tom
 
You cannot perform navigation in a validation trigger which was why you were getting the error. This insures that the cursor does not leave a field that contains an invalid value.

My preferred way of handling this is to have funtions do pure validation and pass back a success/failure. That way the code that invokes the function can determine what it needs to do based on the returned status. For instance, the validation trigger can then determine the value was invalid, issue an error message and then fail. Any other code that invokes the function can do navigation or whatever is required.

[sup]Beware of false knowledge; it is more dangerous than ignorance.[/sup][sup] ~George Bernard Shaw[/sup]
Consultant Developer/Analyst Oracle, Forms, Reports & PL/SQL (Windows)
Author and Sole Proprietor of: Emu Products Plus
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top