Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This is the code for apex.ajax.clob, taken from apex_4_1.js:</p> <pre><code>/** * @namespace = apex.ajax */ apex.ajax = { /*clob*/ clob : function (pReturn){ var that = this; this.ajax = new htmldb_Get(null,$x('pFlowId').value,'APXWGT',0); this.ajax.addParam('p_widget_name','apex_utility'); this.ajax.addParam('x04','CLOB_CONTENT'); this._get = _get; this._set = _set; this._return = !!pReturn?pReturn:_return; return; function _get(pValue){ that.ajax.addParam('x05','GET'); that.ajax.GetAsync(that._return); } function _set(pValue){ that.ajax.addParam('x05','SET'); that.ajax.AddArrayClob(pValue,1); that.ajax.GetAsync(that._return); } function _return(){ if(p.readyState == 1){ }else if(p.readyState == 2){ }else if(p.readyState == 3){ }else if(p.readyState == 4){ return p; }else{return false;} } }, </code></pre> <p>So, clob setting and getting is truly asynchronuous. The code you posted provides a handling function that is called when the request is finished (done in htmldb_get). I think it's an ugly workaround but ok. We need to manipulate this function code for our submit to work. Since the set is async, we can't be sure that the page will not be submitted before the set has occured. To prevent this, amend your clob_set code as such:</p> <pre><code>function clob_set(pSubmit){ var clob_ob = new apex.ajax.clob( function(){ var rs = p.readyState if(rs == 1||rs == 2||rs == 3){ $x_Show('AjaxLoading'); }else if(rs == 4){ //here the clob has actually been saved, and // the ajax call finished $s('P5075_RESPONSETEXT',p.responseText); $x_Hide('AjaxLoading'); //pSubmit is a new param //use it to check if set has been called for //a page submit or not if(pSubmit){ //disable the clob field: it should not be //substituted to the session state!! $('#P5075_STYLESHEET').prop("disabled", true); //actually submit the page. This will submit //all fields to session except the disabled ones apex.submit('SUBMIT'); }; }else{ return false; }; }); if(!$v_IsEmpty('P5075_STYLESHEET')){ clob_ob._set($v('P5075_STYLESHEET')); }; }; </code></pre> <p>Alter your submit button, and have it's action be defined by a dynamic action. You need to do this to prevent the substitution of your clob-fields to the session through the default process. Create a dynamic action which executes javascript, call clob_set with pSubmit set:</p> <pre><code>clob_set(true); </code></pre> <p>Do have a look at the <a href="http://docs.oracle.com/cd/E23903_01/doc/doc.41/e21676/javascript_api.htm#CHDBEACA" rel="nofollow noreferrer">apex.submit api description</a>. Also understand how a button works: it submits the page and will set the request to the name of that button (or another request value if explicitly defined). </p> <p>For example, a button could be named 'APPLY_CHANGES' and have a label 'Change'. This is important if you use for example the built-in row processing. The request value will determine which SQL-action will be invoked, and you can view the possible values in the details of the process, next to the checkboxes for insert/update/delete.</p> <p>Here, a most helpful beautiful flowchart:</p> <p><img src="https://i.stack.imgur.com/v1lFd.png" alt="clob_set flowchart"></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload