Forms Validation [message #424314] |
Thu, 01 October 2009 09:28 |
rkgoyal98
Messages: 39 Registered: October 2009
|
Member |
|
|
I am working on Project that involves upgrading forms and reports from 6Ii to 10g. One of
the problem that i am facing is abount validation of various text items.
Most of the forms are having master details block type setup. In the first block unique ID
is entered and on that basis query is populated in the second block with 10-15 records
from the table. Users are allowed to udate/insert data through 2nd block. In this block
validation is being done by KEY_NEXT_ITEM trigger and there is no problem if user press
tab_key However the problem is that many users navigate through mouse also and in all
those cases KEY_NEXT_ITEM does not fire and this leads to errors in data. I have tried to
put DO_KEY('NEXT_ITEM'); in when WHEN_VALIDATE_ITEM trigger, but it is giving trouble
about illegal restricted procedure on navigation items.
I don't want to disable mouse and dataentry is heavy and mouse movement is infact helpful
Can someone suggest me a workarround for this.
regards
|
|
|
Re: Forms Validation [message #424338 is a reply to message #424314] |
Thu, 01 October 2009 10:45 |
cookiemonster
Messages: 13938 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
Put the validation code in the when-validate-item trigger. Which is where it should have been in the first place for obvious reasons.
|
|
|
|
Re: Forms Validation [message #424343 is a reply to message #424314] |
Thu, 01 October 2009 11:27 |
cookiemonster
Messages: 13938 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
Well navigation code probably does belong in the KEY-NEXT-ITEM trigger, it depends why it's there.
If you want specific help you're really going to have to give us a specific example.
|
|
|
Re: Forms Validation [message #424375 is a reply to message #424314] |
Thu, 01 October 2009 21:46 |
rkgoyal98
Messages: 39 Registered: October 2009
|
Member |
|
|
Thanks for quick responses,
I am posting my code for 2-3 triggers. All this code is at present in key-next-item trigger.
declare
errnum number;
v_refno varchar2(15);
v_curno number;
v_lastno number;
v_recno number;
v_sancdate date;
begin
if :refno is null then -- Check for null value --
chknull;
end if;
SELECT refno into :refno FROM prmaloan WHERE empno=:prmaloan.empno AND
earningdeduction=:prmaloan.earningdeduction AND sancdate=:sancdate
AND refno=:refno;
IF SQL%FOUND THEN
errnum:=errmsg(9999,'This combination exists already..!');
set_item_property('cmd_save',enabled,property_false);
raisetrg;
END IF;
EXCEPTION
WHEN no_data_found THEN
v_refno:=:prmaloan.refno;
v_sancdate:=:prmaloan.sancdate;
v_curno:=get_block_property('prmaloan',current_record);
last_record;
v_lastno:=get_block_property('prmaloan',current_record);
first_record;
set_item_property('cmd_save',enabled,property_true);
go_record(v_curno);
go_item('prmaloan.principalamt');
end;
NEXT_ITEM;
Regards
[EDITED by LF: applied [code] tags]
[Updated on: Fri, 02 October 2009 05:01] by Moderator Report message to a moderator
|
|
|
|
Re: Forms Validation [message #424435 is a reply to message #424314] |
Fri, 02 October 2009 06:33 |
cookiemonster
Messages: 13938 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
If that's the complete trigger code then it doesn't make a lot of sense.
Most of the code in the exception handler appears pointless - you're setting variables you never use.
Also the check of sql%found is a waste of time as you can't get to that point in the code unless the select finds something.
I suspect far more code has been written than is actually needed.
|
|
|
|
Re: Forms Validation [message #424502 is a reply to message #424482] |
Fri, 02 October 2009 14:56 |
|
Littlefoot
Messages: 21818 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
If the column value can be NULL, why do you think that you *must* perform validation? You could set its "Required" property to "Yes", but that's not the point because - obviously - this item's value isn't required.
Though, you can still validate it in WHEN-VALIDATE-RECORD trigger.
|
|
|