WebUtil calls are not supported in triggers that fire before the form is rendered. Please refer to the Forms Builder Online Help. Specifically, review the WebUtil section that discusses "Using WebUtil in your application". Note this statement from the text:
"Once the WebUtil library has been attached to your form you can start to add calls to the various PL/SQL APIs defined by the utility. However, there is an important restriction in the use of WebUtil functions: WebUtil can only start to communicate with the client once the Form has instantiated the WebUtil PJCs. This means that you cannot call WebUtil functions before the Forms user interface is rendered. This would include triggers such as PRE-FORM, WHEN-NEW-FORM-INSTANCE and WHEN-NEW-BLOCK-INSTANCE for the first block in the Form.
Likewise you cannot call functions after the user interface has been destroyed for instance in POST-FORM.
If you do need to use WebUtil at Forms startup, it is recommended that you create a timer with a short duration (about 1ms) in your WHEN-NEW-FORM-INSTANCE trigger, then make the WebUtil call in a WHEN-TIMER-EXPIRED trigger"
Thanks dear Mechael .. but I already tried to call WebUtil by button pressed trigger after form initialized and result was the same. in other words I changed my approach to WHEN-BUTTON-PRESSED, the problem is not in WebUtil because I tried to show the value by MESSAGE built-in after initialization "Client_info_Pkg.SET_IP_Address" using Client_info_Pkg.GET_IP_Address and it get the correct local IP Address without any problems. the problem is the trigger can not feel that.
I would suggest at least a few things.
Simplify your code for testing purposes. In other words, try hardcoding a value being passed to the db. For example:
Client_Info_Pkg.Set_IP_Address('THIS IS A TEST')
If the above works then make minor change to your Forms code. Again, do not do this in a PRE-FORM trigger.
-- This is just a snippet of code. Obviously add the concept to your code where it applies Declare user_ip varchar2(30); Begin user_ip := WEBUTIL_CLIENTINFO.GET_IP_ADDRESS; SYNCHRONIZE; Client_Info_Pkg.Set_IP_Address(user_ip); End;
It's the same result . The trigger can't feel the initialization that happened in my form. the values inserted in a column is null. Although I used MESSAGE(WEBUTIL_CLIENTINFO.GET_IP_ADDRESS) built-in after the code you suggested and it returned the correct IP Address, also I tried another way to fully ensure I created dummy table contain one column to insert the IP address returned by WEBUTIL_CLIENTINFO.GET_IP_ADDRESS) and then committed it, Also worked and returned the correct value when I issued select statement against that table. any ideas!
I think you need to test this outside of Forms somehow. You may find it necessary to store the value on a table for later retrieval. I don't think this has anything to do with Forms.
I solved my problem using CONTEXT object, thank you Michael for your interest.