Getting and setting page items with JavaScript functions $v and $s

The $v function

The $v function is a JavaScript function provided by Oracle APEX that allows you to retrieve the value of an item on an APEX page. The function takes one parameter, which is the name of the item you want to retrieve the value for. The syntax for using $v is as follows:

$v("ITEM_NAME");

Here, “ITEM_NAME” is the name of the item you want to retrieve the value for. The function returns the current value of the item.

You can use the $v function in any JavaScript code on your APEX page, including dynamic actions, JavaScript functions, and event handlers. For example, if you have a text field item with the name “P1_NAME” on your page, you can retrieve its value using the following code:

var name = $v("P1_NAME");

The $s function

The $s function is a JavaScript function provided by Oracle APEX that allows you to set the value of an item on an APEX page. The function takes two parameters: the name of the item you want to set the value for, and the new value you want to set. The syntax for using $s is as follows:

$s("ITEM_NAME", "NEW_VALUE");

Here, “ITEM_NAME” is the name of the item you want to set the value for, and “NEW_VALUE” is the new value you want to set for the item. The function sets the value of the item to the new value.

You can use the $s function in any JavaScript code on your APEX page, including dynamic actions, JavaScript functions, and event handlers. For example, if you want to set the value of a hidden item with the name “P1_HIDDEN” to “Hello World”, you can use the following code:

$s("P1_HIDDEN", "Hello World");

You can find more information about the $v and $s function in the APEX documentation. Check out the Oracle APEX JavaScript API Reference.

Leave a Reply

Your email address will not be published. Required fields are marked *