Use APEX_APPLICATION in an application process called by a javascript
648804Dec 2 2008 — edited Dec 11 2008I have a page that is split into two; Top portion is a form, and the bottom part is a tabular form of a collection. Currently, if I enter information into the form and the collection and then submit the collection (to save the data to the collection) it erases the information in the form (since submitting for the form is separate). The same thing happens when I attempt to delete certain rows from the collection.
My solution to this problem was to use javascript to call an application process (that way the page isn't completely refreshed, only the collection portion). However, I can't seem to get the apex package APEX_APPLICATION to work correctly as an application process (works fine as a process on submit as a page process).
Below is the way I use apex_application for saving:
begin
for x in 1..apex_application.g_f03.COUNT
loop
apex_collection.update_member_attribute (p_collection_name=> 'SPECIES_COLLECTION',
p_seq => apex_application.g_f03(x),
p_attr_number => 8,
p_attr_value => apex_application.g_f08(x));
apex_collection.update_member_attribute (p_collection_name=> 'SPECIES_COLLECTION',
p_seq => apex_application.g_f03(x),
p_attr_number => 9,
p_attr_value => apex_application.g_f09(x));
apex_collection.update_member_attribute (p_collection_name=> 'SPECIES_COLLECTION',
p_seq => apex_application.g_f03(x),
p_attr_number => 10,
p_attr_value => apex_application.g_f10(x));
apex_collection.update_member_attribute (p_collection_name=> 'SPECIES_COLLECTION',
p_seq => apex_application.g_f03(x),
p_attr_number => 11,
p_attr_value => apex_application.g_f11(x));
apex_collection.update_member_attribute (p_collection_name=> 'SPECIES_COLLECTION',
p_seq => apex_application.g_f03(x),
p_attr_number => 12,
p_attr_value => apex_application.g_f12(x));
end loop;
end;
Below is the code I use for deleting certain elements from the collection:
BEGIN
FOR ii IN 1 .. apex_application.g_f01.COUNT -- checkbox
LOOP
apex_collection.delete_member (p_collection_name => 'SPECIES_COLLECTION',
p_seq => apex_application.g_f01(ii)
);
END LOOP;
APEX_COLLECTION.RESEQUENCE_COLLECTION('SPECIES_COLLECTION');
END;
Below is the javascript I attempted to use for application process for submitting:
function addToCollection()
{
var get =
new htmldb_Get(null,&APP_ID.,'APPLICATION_PROCESS=submitLandings',0);
gReturn = get.get();
get = null;
}