Home » Developer & Programmer » Forms » WHEN-VALIDATE-ITEM for a non-navigable item (Forms 10g)
WHEN-VALIDATE-ITEM for a non-navigable item [message #657776] Tue, 22 November 2016 07:44 Go to next message
adfnewbie
Messages: 46
Registered: January 2016
Member
Hi guys,

Is there any way I can execute when-validate-item for a field which is not displayed on the form.

-RC
Re: WHEN-VALIDATE-ITEM for a non-navigable item [message #657777 is a reply to message #657776] Tue, 22 November 2016 07:49 Go to previous messageGo to next message
cookiemonster
Messages: 13777
Registered: September 2008
Location: Rainy Manchester
Senior Member
yes.
WVI firing is based on the items item_is_valid property. Before a row can be saved to the DB all items in the block need to have that property be true. It gets to be true by passing any validation attached to it - mainly WVI, but also certain properties - format mask, required.
Normally forms fires the WVI as soon as you navigate out of a field, or when you press save. First doesn't apply in this case, but the second does.
Re: WHEN-VALIDATE-ITEM for a non-navigable item [message #657778 is a reply to message #657777] Tue, 22 November 2016 07:51 Go to previous messageGo to next message
cookiemonster
Messages: 13777
Registered: September 2008
Location: Rainy Manchester
Senior Member
All that said, if the field isn't visible then presumably it's getting its value based on what happens to another field(s) in which case it may be simply to just do the necessary validation on those.
It's hard to say without knowing how the field gets populated and what validation needs doing.
Re: WHEN-VALIDATE-ITEM for a non-navigable item [message #657779 is a reply to message #657778] Tue, 22 November 2016 08:00 Go to previous messageGo to next message
adfnewbie
Messages: 46
Registered: January 2016
Member
"It's hard to say without knowing how the field gets populated and what validation needs doing." ---> The value to this field is assigned explicitly using copy(lv_ship_to_location,'ORDER.SHIP_TO_LOCATION') in custom .pll.

When I show the field using Tools > Show Field, the logic works just fine. But if that field is not shown, then it does not work.
Re: WHEN-VALIDATE-ITEM for a non-navigable item [message #657780 is a reply to message #657779] Tue, 22 November 2016 08:16 Go to previous messageGo to next message
cookiemonster
Messages: 13777
Registered: September 2008
Location: Rainy Manchester
Senior Member
Unless you tell us what the logic is it's not really possible to work out what's going wrong.
Also wouldn't it make more sense to change the procedure that does the copy so that it only copies the value if you're happy with it?
Re: WHEN-VALIDATE-ITEM for a non-navigable item [message #657781 is a reply to message #657780] Tue, 22 November 2016 08:19 Go to previous messageGo to next message
cookiemonster
Messages: 13777
Registered: September 2008
Location: Rainy Manchester
Senior Member
Is ORDER.SHIP_TO_LOCATION a DB item?
Have you checked its item_is_valid property before and after doing the copy?
Re: WHEN-VALIDATE-ITEM for a non-navigable item [message #657782 is a reply to message #657781] Tue, 22 November 2016 08:52 Go to previous messageGo to next message
adfnewbie
Messages: 46
Registered: January 2016
Member
Lets go back a bit to see what I am doing and what i intend to:
Note: All fields mentioned are db items

> There are 8 fields on the form - 4 belongs to SHIP_To & other 4 to BILL_TO addresses for a customer
> BILL_TO_LOCATION & SHIP_TO_LOCATION are non-displayed, rest are displayed and enabled on the form

Existing functionality : If BILL_TO_LOCATION/SHIP_TO_LOCATION is displayed on form (Using Tools> Show field) > given a value > tab out, rest all fields are changed accordingly. (I am not sure how this happens.)
Intended functionality : I do not want to show the field on form. I want to assign a value to the field and implement what happens as in existing functionality.

-RC
Re: WHEN-VALIDATE-ITEM for a non-navigable item [message #657783 is a reply to message #657782] Tue, 22 November 2016 09:34 Go to previous messageGo to next message
cookiemonster
Messages: 13777
Registered: September 2008
Location: Rainy Manchester
Senior Member
Well then you need to work out what populates the other fields when you change the *_to_location.
Re: WHEN-VALIDATE-ITEM for a non-navigable item [message #657787 is a reply to message #657782] Tue, 22 November 2016 14:42 Go to previous message
Littlefoot
Messages: 21530
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
adfnewbie

(I am not sure how this happens.)
If you wonder how to find that out, set a breakpoint into one of PL/SQL program units (if nothing else, create a WHEN-NEW-FORM-INSTANCE trigger, put NULL; in it and set a breakpoint to that statement by right-clicking the left PL/SQL window margin). Then run the form in debug mode and follow its execution, step by step.
Previous Topic: Clearing a Block with fields Required YES
Next Topic: COPY function not passing variable to datablock
Goto Forum:
  


Current Time: Sun Jan 19 13:46:23 CST 2020