Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Region plugin, AJAX callback function

BotzyMar 29 2023

I'm getting the error with checksum when I call my Plugin AJAX function. I think I've boiled it down to my AJAX call from javascript is probably malformed. I'm in APEX version 22.1

My error message is:

"error":"Checksum format error"

My AJAX function definition looks like this:

function GET_LOV_VALUES_AJX (
    p_region in apex_plugin.t_region,
    p_plugin in apex_plugin.t_plugin )
    return apex_plugin.t_region_ajax_result
 as
    l_vset VARCHAR2(32767) := apex_application.g_x01;
    l_segment VARCHAR2(4000) := apex_application.g_x02;
    l_parentval VARCHAR2(4000) := apex_application.g_x03;
    l_partial VARCHAR2(4000) := apex_application.g_x04;
    l_result apex_plugin.t_region_ajax_result;
BEGIN
  apex_json.open_object;
  apex_json.write('success', true);
  apex_json.open_array('results');

  FOR c IN (Select value return_value, description display_value
            from vs_value_v
            where vset_name = l_vset
            and isenabled = 'Y'
            and nvl(parent_value, '¤') = nvl(l_parentval,'¤')
            order by value, description)
  LOOP
    apex_json.open_object;
    apex_json.write('value', c.return_value);
    apex_json.write('displayValue', c.display_value);
    apex_json.close_object;
  END LOOP;
  apex_json.close_array;
  apex_json.close_object;
  --l_result := my_plugin_region.render;
  return l_result;

END;

Then I try to invoke the ajax function as follows:

apex.server.plugin('GET_LOV_VALUES_AJX', {
x01: "Sometext",
x02: "Sometext2",
x03: "SomeValue3",
x04: "4"
}, {
success: function(pData) {
console.log(pData);
}
});

But it fails with the error.

{
"error":"Checksum format error"
,"addInfo":"Contact your application administrator."
,"pageSubmissionId":"14428555........etc"
}

How do you invoke these functions correctly, could someone maybe show me what my AJAX call should look like? Is apex.server.plugin the correct method to use for this?

I should mention that, if I put the same logic inside a page process instead, on a page where my plugin exists, then I can successfully invoke that process from javascript inside the plugin/browser, and it returns my values - but I can't settle with that approach, because that would defeat the purpose of making a plugin, as I need the retrieval logic of the LOV values to be encapsulated inside the plugin.

Anyone have experience with this, who can share some insights on this (it's my first APEX plugin).

This post has been answered by Louis Moreaux on Mar 30 2023
Jump to Answer
Comments
Post Details
Added on Mar 29 2023
3 comments
1,548 views