

The new components/attributes for Form Regions are: If you wanted to do anything more complicated than that, you had to either split your form into multiple pages or get rid of the DML processes and hand-code the PL/SQL yourself. In prior versions of APEX, you were effectively limited to a single DML load process and a single DML submit process, and all the items on the page that were linked to a table column were required to be from only a single table. The new Form Region feature introduced in Oracle APEX 19.1 is a big improvement to the way that single-record forms are defined declaratively. To do this, I add a call to utl_i18n.unescape_reference:ĪPEX / APEX_ESCAPE / apex-18.2 / tips-&-tricks / UTL_I18N / Instead, before sending this string to my procedure, I’ve chosen to unescape the data. This would allow using a surrogate key for the vendor list and this escaping behaviour would no longer be a problem.Īnother alternative here is to use the latest transaction ID as a surrogate key for each vendor but then I would need to modify the form to translate this back into a vendor name when inserting or updating the table and this would add unnecessary complexity to this simple form, in my opinion. If I was doing this properly, I would fix the data model to make vendors first-class entities, instead of using a free-text field.
#Apex sql insert action code#
Usually, I would try to rework my code to send a numeric ID instead of a string but in this particular case the data model does not have surrogate keys for vendors (it’s just a free-text field in the transactions table) so I want to use the name. I believe APEX uses the apex_escape.html function to do this. “Ben & Jerry’s” was escaped to “ Ben & Jerry's“. Therefore, the value sent by the dynamic action to my PL/SQL procedure had the special html characters escaped, e.g.

This is because the item had Escape special characters set to the default (Yes), which is good practice to protect against Cross-Site Scripting (XSS) attacks. I also think this quote is telling: " This is extremely useful for async success/failure, because you're less interested in the exact time something became available, and more interested in reacting to the outcome.This didn’t work in some cases where a vendor name included special characters, such as &. And extremely new, unsupported by even IE11. ha.īut they are just the native implementation of deferred objects. anything here will run before plsql finishedĮddie suggested using "promises", which sounded promising. ("CB_AJAX" // this is just => htp.p('X') If that hurts your head a little, welcome to JavaScript mechanics. " javascript return result from callback" is an obscenely googled phrase, with a fair response of: " This is impossible as you cannot use an asynchronous call inside a synchronous method." The next example uses 'deferred objects', which is jQuery's updated method for handling "success", but we can't access the callback values outside that scope, so we can't return true or false. This works, is completely synchronous, but will only work in browsers for a finite time thanks to the highlighted row ( async:false).Ĭonsole.log('success:'+ (result.length)) CB_AJAX is an AJAX callback (PL/SQL) defined on the page and returns a number as a text string. A common sentiment on from MDN.īelow are the examples we attempted for the JavaScript to return true or false, hence triggering the appropriate true/false dynamic actions.
