-
1. Re: Dynamic Action jQuery Selector Problem
Tom Petrus Feb 22, 2014 11:54 AM (in response to Becky-IT)Have you tried to run your selector in the browser's console (eg firebug)? Is your region perhaps being refreshed? Is the scope of the action set to static or dynamic?
-
2. Re: Dynamic Action jQuery Selector Problem
Becky-IT Feb 24, 2014 1:22 PM (in response to Tom Petrus)Tom,
I have used Firefox's debugger. I can see other DAs firing but not this one.
I don't know of anything that would cause the region to refresh.
I don't know what your last question means:
Is the scope of the action set to static or dynamic?
Thanks,
Becky
-
3. Re: Dynamic Action jQuery Selector Problem
Tom Petrus Feb 24, 2014 1:28 PM (in response to Becky-IT)Sorry, in apex 4.1 the scope is the bind type of the dynamic action, "Live" or "Bind". If I'm not mistaken it is under the advanced part of the DA (not true/false action).
When your page has finished loading, have you tried to run your selector from the console: $(select[name="f05"]) and if yes, this does return elements?
-
4. Re: Dynamic Action jQuery Selector Problem
Becky-IT Feb 24, 2014 2:39 PM (in response to Tom Petrus)Tom,
The bind type is "Bind".
Interesting fact: In Firefox, the following errors do not occur, only in IE:
IE throws error "Object doesn't support this property or method" which is (function(){apex.da.initDaEventList();})();
IE is also throwing an error in the Dynamic Query:
var elem = '#' + this.triggeringElement.id;
var key = '#' + 'f02_' + this.triggeringElement.id.substring(4);
var set_list = '#' + 'f04_' + this.triggeringElement.id.substring(4);
var key_val = $(key).val();
var elem_val = $(elem).val();
var selected_val = '';
apex.server.process (
"getEmployees",
{
x01: elem_val,
x02: key_val
},
{
success: function( pData ) {
$(set_list).find('option').remove();
$.each(pData, function(key, innerjson) {
$(set_list).append($('<option>', {
value: innerjson.VALUE,
text: innerjson.NAME
}))
if (innerjson.SELECTED != '') {selected_val = innerjson.SELECTED};
});
if (selected_val != '') {
$('select' + set_list + ' option').each(function()
{this.selected = (this.text == selected_val);});
}
},
} <--------- HERE
);
How do you run the selector from the console: $(select[name="f05"])? All I have is the Firefox debugger. Firebug stopped working last week.
-
5. Re: Dynamic Action jQuery Selector Problem
Becky-IT Feb 24, 2014 3:30 PM (in response to Becky-IT)Tom,
I was just informed the Firefox debugger IS the new Firebug!! So I did figure out how to run the selector from the console: I received the following: ReferenceError: select is not defined.
-
6. Re: Dynamic Action jQuery Selector Problem
Becky-IT Feb 24, 2014 7:48 PM (in response to Becky-IT)In doing more research I believe the apex.server.process and associated select are in 4.2 and not in 4.1. Is there a work around?
-
7. Re: Dynamic Action jQuery Selector Problem
Aljaz Feb 25, 2014 9:55 AM (in response to Becky-IT)Hi,
you can use htmldb_Get
Regards,
Aljaz
-
8. Re: Dynamic Action jQuery Selector Problem
Tom Petrus Feb 25, 2014 2:13 PM (in response to Becky-IT)with $(select[name="f05"]) I actually meant $('select[name="f05"]') - sorry, forgot the quotes there.
And yes, apex.server.process is new in apex 4.2 and not in 4.1. You could use htmldb_Get, yes. But why not use $.ajax until you get to 4.2. This can only be a good thing since apex.server.process wraps $.ajax, and can take the same options and also returns the same object. You'll have a good headstart on it by using proper ajax calls.
Eg:
var ajaxData = { "p_request" : "APPLICATION_PROCESS=getEmployees"
, "p_flow_id" : $v('pFlowId')
, "p_flow_step_id" : $v('pFlowStepId')
, "p_instance" : $v('pInstance')
, "x01" : elem_val
, "x02" : key_val
};
$.ajax(
{ "url" : 'wwv_flow.show' //URL request is sent to
, "type" :"POST" //type of ajax request. GET,POST,...
, "dataType" :"text json" //how jquery will parse the return value. Default in 4.2 JSON
, "data" : ajaxData //object with data to be sent which will be converted to a query string
, "success" : function(pData){
//handle the successful return -> pData
}
}
);
All info on $.ajax: jQuery.ajax() | jQuery API Documentation
-
9. Re: Dynamic Action jQuery Selector Problem
Becky-IT Feb 25, 2014 8:05 PM (in response to Becky-IT)Tom,
I realized these errors are caused by missing APIs in version 4.1.1. The specific APIs are "apex.server.process" and "apex.da.initDaEventList()". Is there a possible workaround?
-
10. Re: Dynamic Action jQuery Selector Problem
Tom Petrus Feb 25, 2014 9:05 PM (in response to Becky-IT)Yes, for apex.server.process, use $.ajax (jQuery) (see above, my previous post) or the old, undocumented htlmdb_get. apex.da.initDaEventList() is not a problem, it just errors out because it initializes the dynamic actions. If one contains an error, then you're likely to see an error on that line. (You're not even calling it directly)
-
11. Re: Dynamic Action jQuery Selector Problem
Becky-IT Feb 26, 2014 3:24 PM (in response to Tom Petrus)Hi Tom,
I didn't think I had posted the "work around" request!! Thanks so much. I will try it out!
Becky
-
12. Re: Dynamic Action jQuery Selector Problem
Becky-IT Feb 26, 2014 3:45 PM (in response to Becky-IT)Tom,
Will I try out the new code. In the meantime, I still cannot get the DA running. I entered $('select[name="f05"]' as you suggested. I get [object Object] which in looking at it, it does contain the Type list. The DA is just not firing!
-
13. Re: Dynamic Action jQuery Selector Problem
Tom Petrus Mar 3, 2014 8:09 AM (in response to Becky-IT)Becky,
The selector will probably work fine, but as long as there is invalid javascript code in there, you might run into problems. If you want to make sure, try only using an alert on change.
-
14. Re: Dynamic Action jQuery Selector Problem
Becky-IT Mar 5, 2014 4:44 PM (in response to Tom Petrus)Thanks Tom. I did just that and it still doesn't work. I have since upgraded ApEx to 4.2.4!! Hopefully that may shed some light on the subject!
Becky