Solved

validation and cursor navigate?

Posted on 2004-04-01
15
1,211 Views
Last Modified: 2007-12-19
hi

i need to validate all items on my form .... if there is any error on a specific item

 the cursor(mouse or key) will go to it and let user 2 correct it..........is that possible?

i don't  want to use post_text_item trigger

thanks
0
Comment
Question by:julia2004
  • 7
  • 6
  • 2
15 Comments
 
LVL 5

Expert Comment

by:mudumbe
ID: 10734851
You can use VALIDATE built-in.
0
 
LVL 6

Expert Comment

by:musdu
ID: 10738678
Hi,

to validate the all fields in a form you can use VALIDATE(FORM_SCOPE) built-in.

Your fields should have when-validate-item triggers and in it you should use RAISE FORM_TRIGGER_FAILURE statement to fail validation. VALIDATE(FOTM_SCOPA) built-in executes all when-validate-item-triggers (also checks validation properties of items). If a validation fails, cursor is placed on the item automatically.

regards
0
 

Author Comment

by:julia2004
ID: 10743915

thansk

i did it befor ... i use the validation builtin and and set the scope to form

and i put (post_text_item) triggers to all fields i need to check it..

it is not working

i change the items validation triggers to (when validate item) ...also it is the same result

it  skip the validation and do commit!!




 
0
 
LVL 5

Expert Comment

by:mudumbe
ID: 10744009
It is recommended that you validate in WHEN-VALIDATE-ITEM trigger.

Check if validation is turned off....If so forms will not do validation.

This has to be done programatically using SET_FORM_PROPERTY built-in:

The following will turn off validation:

SET_FORM_PROPERTY('form_name', VALIDATION, PROPERTY_FALSE);

To find whether it is turned off use:

SET_FORM_PROPERTY('form_name', VALIDATION);
0
 

Author Comment

by:julia2004
ID: 10744419

it is the same problem :(

get_form_property('myform',valdiation) = true

i think the problem is on the place of calling validate ?

what is your recommendation?


thanks again
0
 
LVL 6

Expert Comment

by:musdu
ID: 10746705
Hi,

set "Validation Unit" property of your form to "DEFAULT", create a when-validate-item trigger for one of your items and use RAISE FORM_TRIGGER_FAILURE statement to fail validation. Add some messages in your trigger code in order to understand whether or not it is fired.

copy and paste your trigger code please.

regards.
0
 

Author Comment

by:julia2004
ID: 10747345

i put save button on my form fire this trigger when-button-pressed
(       Validate(form_scope);
IF NOT Form_Success THEN
          RAISE Form_Trigger_Failure;
         END IF;  
  IF :System.Form_Status = 'CHANGED' THEN
 
           Commit_Form;    
     IF :System.Form_Status <> 'QUERY' THEN  
         Bell;       RAISE Form_Trigger_Failure;  
   END IF;
     END IF; )

on  item3 (it is a summation of item1 and item2 )
 i put the trigger when_validate_item
( IF  :Block1.Item3 <> (:Block1.Item1 +:Block1.Item2) THEN
    Message(' Please Check  The Summation ');
    RAISE Form_Trigger_Failure;
      END IF; )




0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 6

Accepted Solution

by:
musdu earned 50 total points
ID: 10751269
Hi,

add this line to the beginning of your when-button-pressed trigger;

-This line causes the when-validate-item trigger to be fired during Validate(FORM_SCOPE);
:BLOCK1.Item3 := :BLOCK1.Item3;

-- your code
Validate(form_scope);

IF NOT Form_Success THEN
   
   -- Instead of hard-coding of your item name you can assign item name to a variable in when-validate-item triggers
   Go_Item('block1.item3');

END IF;  
0
 

Author Comment

by:julia2004
ID: 10756753

thanks for your help

it is still not working


your solution check only the result ... item1 and item2 not effected
it will be pass them without checking...

for example
at runtime
i put  item1 = 1 and item2 = 2 and  left  item3 = null
it will be accept it and also
if i put
     item1 = null  and item2 = 2 and    item3 = 3

--
it is useless way to check all item one by one ( i have more than 50 different item on my form need to recalculate ).

i think my problem is clear now
0
 
LVL 6

Expert Comment

by:musdu
ID: 10756819
Hi,

how do you populate your items? If your item is changed above code will fire validation triggers. If your items are not changed, validate built-in will not fire them. That's why I assigned BLOCK1.Item3 to itself.

Is it acceptable to put all validation triggers into your button code?
0
 

Author Comment

by:julia2004
ID: 10756913

yes.. it will fire validation trigger only at item3....
if i leave it with out change and change item2 or item1 ... it will be accept it

i don't want to validate all items


----
 it is database items
0
 
LVL 6

Expert Comment

by:musdu
ID: 10757811
If your item is changed, you need nothing to validate it. When-validate-item trigger is automatically fired when the cursor leaves the item.

Could you copy-paste one of your when-validate-item trigger please?
0
 

Author Comment

by:julia2004
ID: 10760614

i wrote it befor

on  item3 (it is a summation of item1 and item2 )
 i put the trigger when_validate_item
( IF  :Block1.Item3 <> (:Block1.Item1 +:Block1.Item2) THEN
    Message(' Please Check  The Summation ');
    RAISE Form_Trigger_Failure;
      END IF; )

0
 
LVL 6

Expert Comment

by:musdu
ID: 10763486
Hi,

write below code in when-button-pressed-trigger. (Change BLOCK2 with your block name) Your button must be in a different block. (If it's in the same block we should make some changes in this code)

DECLARE

  vItem VARCHAR2(100);
  vFirstItem VARCHAR2(100);
  vLastItem VARCHAR2(100);
  vMyBlock VARCHAr2(30) := 'BLOCK2';

BEGIN
      
      vFirstItem := Get_Block_Property(vMyBlock, FIRST_ITEM);
      vLastItem := Get_Block_Property(vMyBlock, LAST_ITEM);
      vItem := vFirstItem;
      
  LOOP
 
    Copy(name_in(vItem), vItem);
    EXIT WHEN vLastItem = vItem;      
    vItem := Get_Item_Property(vItem, NEXTITEM);
 
  END LOOP;

  validate(form_scope);  

END;

0
 

Author Comment

by:julia2004
ID: 10764979

hi musdu

i solve it .... the problem was in null values

i used NVL function ...and it is working


 IF  NVL(:Block1.Item3,0) <> (NVL(:Block1.Item1,0) +NVL(:Block1.Item2,0)) THEN
    Message(' Please Check  The Summation ');
    RAISE Form_Trigger_Failure;
      END IF; )

thanks alottt for your help
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Introduction A previously published article on Experts Exchange ("Joins in Oracle", http://www.experts-exchange.com/Database/Oracle/A_8249-Joins-in-Oracle.html) makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now