The goal of this article is to highlight how APEX actually processes the data that is sent data from the browser to the server when a submit button is pressed.
Stripping out a lot code, the underlying HTML code for this page looks like:
<form action="form.accept" id="Form" method="post" name="form">
<input name="p_arg_names" type="hidden" value="1234567891" />
<input id="P1_FIRST_NAME" name="p_t01" type="text" value="" />
<input name="p_arg_names" type="hidden" value="1234567892" />
<input id="P1_LAST_NAME" name="p_t02" type="text" value="" />
</form>
You’ll notice that despite their being four input elements they’re really only three unique sets of names that are used: p_arg_names
, p_t01
, and p_t02
. When the page is submitted the web server (APEX) will get/processes the following elements:
p_arg_names[1] = 1234567891
p_arg_names[2] = 1234567892
p_t01 = Name
p_t02 = Surname
None of the data sent back to the server make reference of P1_FIRST_NAME
or P2_LAST_NAME
. As well, p_arg_names
is stored in a top down order of how they are in the page.
p_arg_names
values are actually the IDs for each of the of the page items as highlighted in the following query:
select item_id, item_name from apex_application_page_items where 1=1 and application_id = 118 and page_id = 1; ITEM_ID ITEM_NAME ----------------- ------------- 1234567891 P1_FIRST_NAME 1234567892 P1_LAST_NAME
APEX is able to map the data back to their corresponding APEX items by first mapping the values in p_arg_names
to the apex_application_page_items
view and then using the values in the p_txx
to retrieve the data that was submitted for each item.
The order that the values are submitted in for p_arg_names
must match the p_txx
values for APEX to correctly map the values to their appropriate APEX item. I.e. p_args_names[1]
will link to p_t01
and p_arg_names[2]
will link to p_t02
etc.