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!
Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.
Do you have a use-case? You may be able to use dynamic actions anyway.
Many questions are left unanswered with something outside the box because the question was missing it's goal.
Hi Scott,
Thanks for replying back.
Let me walk you through the sample scenario why I need the javascript to fire dynamic action.
I have report, with links that opens modal windows to enter some code values or other types of information based on information that is very specific to each record. So I have written javascript function to fire off by passing the parameters from the javascript function and set those values from the javascript function and then call the dynamic action to perform some server side events.
In this perspective, I would like to trigger the dynamic action based on some conditions from javascript and user behavior.
If you can help me out in calling DA's from JS that would be really great.
I'm not javascript expert so I won't comment on possible enhancements to that facet, but one idea came to mind.
You could set the value of a P0_SIGNAL item (for argument's sake), and have an onChange even on P0_SIGNAL, potentially looking at specific values to execute relevant action.
Might that work in your case?
RameshP,OracleAPEXDeveloper wrote: Hi Scott, Thanks for replying back. Let me walk you through the sample scenario why I need the javascript to fire dynamic action. I have report, with links that opens modal windows to enter some code values or other types of information based on information that is very specific to each record. So I have written javascript function to fire off by passing the parameters from the javascript function and set those values from the javascript function and then call the dynamic action to perform some server side events. In this perspective, I would like to trigger the dynamic action based on some conditions from javascript and user behavior. If you can help me out in calling DA's from JS that would be really great.
RameshP,OracleAPEXDeveloper wrote:
Is it not possible to use dynamic actions instead of you javascript in first place?
Hi VC,
As I am passing parameters from the javascript function which could be multiple at ttimes it would be hard.
I am also using dynamic actions in correlation with javascript.
I heard in 4.2.* version its possible to fire dynamic action from javascript also, but not sure how to do that.
I also have same idea when doing this and approached this pattern but of no help.
The dynamic actions wouldn't trigger if the values are changed from the javascript
E: $("#P0_SIGNAL").val(123);
That is the reason even this thread is opened, I can get things around using complete javascript making ajax calls but want to take advantage of DA's
Thank you all.
You can do this. Just define a Dynamic Action on some event that you never expect to fire and then trigger it from another JavaScript block using the apex.event.trigger command. Here is an example (I am firing the change event which, in turn fires the Dynamic Action tied to the change event):
apex.event.trigger( $('#MARGIN_BUILDER_RR').find('input,select'),'change');
-Joe
Hi Jeo,
I tried your solution, but couldn't get the results, so I started playing little with your code and i finally got it.
So here is what I have done to get it fired.
Create a hidden item and on that change have your dynamic action fired, but in fact in reality your dynamic action will never fire as it is hidden item.
So execute this code from javascript
apex.event.trigger($("#P3_TEST_ID"),"change","");
When you create a dynamic action, make sure it fires on P3_TEST_ID page item change.
I finally got it working one way or the other.
But still not happy with the solution as its only a tweek instead ok executing the dynamic action by name or atleast its sequence order.
So giving it "HELPFUL"
Ramesh,
By definition, Dynamic Actions are pre-defined *events* This means that they are call back routines that listen for some particular condition. For example, a click or a change or whatever. So, it isn't just that you can't call a Dynamic Action by its name, you can't call *any* event by its name. That just isn't what events are. Events are not named JavaScript routines. If you want to simply execute by name, then, as Scott suggested above, you would create JavaScript functions and just call them (by name).
As to sequence order, I am not really sure what you mean.You could add several "True" scripts under the same DA and these would fire in the sequence that you specify. Also, you could add a bunch of hidden controls and tie multiple DAs to the change events. There's lots of ways to handle the sequencing.
Simpler to trigger using
$("#P0_SIGNAL").val(123).change();
I have tried these two techniques in which I am not successful.
$("#P0_SIGNAL").val(123).change(); -- Failed
$("#P0_SIGNAL").trigger("change"); --Failed
But anyways something like this apex.event.trigger($("#P3_TEST_ID"),"change","");
I am able to get around,
Thanks for all of your support in getting this task done.
I am pleased to have a community like this.
Ramesh P.
Can you describe why it failed? Errors? behaviour?
Yeah surely I can explain.
The dynamic actions that are intended to fire on calling the two failed codes didn't trigger the dynamic action to fire.
Hi,
The correct answer to this post:
Not sure, why the following to lines of code didn't work to trigger a dynamic action
$("#P0_SIGNAL").val(123).change(); -- Failed$("#P0_SIGNAL").trigger("change"); --Failed
This line would trigger a dynamic action from javascript. apex.event.trigger($("#P3_TEST_ID"),"change","");
Steps to make it working.
I need to trigger a dynamic action when some value is set to hidden item from javascript
P3_TEST_ID is a hidden item.
Create a dynamic action to fire on P3_TEST_ID change event.
Setting the p3_test_id value from javascript wouldn't trigger dynamic action.
Execute the following code to fire DA from javascript
In 4.2 you can use a custom event to trigger the dynamic action: Read Article - Run Dynamic Action from JavaScript
This line in javascript would trigger the dynamic action:
$.event.trigger("DAEvent");
$.event.trigger(
"DAEvent"
);
"DAEvent" can be any name you choose and used in the dynamic action.
Define the dynamic action as a "custom" event, with the custom event name the name of the event that you triggered ("DAEvent" in the example above)
--Jeff
Jeff's example finally gave me enough interest to create this example
Dynamic Action events
I provide sample javascript and plsql chained dynamic actions, as well as triggering a specific dynamic action.
Cool stuff!
Great examples, Scott. Thanks, for putting that together. I leaned some stuff!
Hi Jeff,
Thank you for the update.
I am using Apex 4.1 version.
Anyways I heard about it and learned how to trigger DA from javascript by name
so did I ;-)