Home » Developer & Programmer » Forms » Forms Validation (Develoer Suite 10g)
Forms Validation [message #424314] Thu, 01 October 2009 09:28 Go to next message
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 Go to previous messageGo to next message
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 #424340 is a reply to message #424338] Thu, 01 October 2009 11:04 Go to previous messageGo to next message
rkgoyal98
Messages: 39
Registered: October 2009
Member

I have done that too, but all the items like go_block,next_record are leading to illegal procedure
Regards
Re: Forms Validation [message #424343 is a reply to message #424314] Thu, 01 October 2009 11:27 Go to previous messageGo to next message
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 Go to previous messageGo to next message
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 #424421 is a reply to message #424375] Fri, 02 October 2009 05:06 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
As far as I can tell, there's no need to use restricted procedures at all. As Cookiemonster has said, validation should be done in WHEN-VALIDATE-ITEM trigger. Check whatever you want in there and raise an error if validation fails. There's no need to store information about "current record" or "go to an item" because focus will stay on an item (and in the same record) where validation has failed.
Re: Forms Validation [message #424435 is a reply to message #424314] Fri, 02 October 2009 06:33 Go to previous messageGo to next message
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 #424482 is a reply to message #424314] Fri, 02 October 2009 10:49 Go to previous messageGo to next message
rkgoyal98
Messages: 39
Registered: October 2009
Member

Hello,

Thanks for the reply. I think i will revamp the whole thing and will come back for sugessions.
kindly advise me one more thing ---

Will when-validate-item also fire even if user skips the textbox and as such there is null in that item. I have tried to raise trigger in the when-validate-item if the item remains null, but found that there is still data in the table with null values. I can not change table design to add constraiints.

Regards
Re: Forms Validation [message #424502 is a reply to message #424482] Fri, 02 October 2009 14:56 Go to previous message
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.
Previous Topic: Check boxes
Next Topic: Why i need to press the push button twice to complete my action?
Goto Forum:
  


Current Time: Fri Sep 20 15:29:22 CDT 2024