Dynamic action calling JavaScript with parameters
I have a DA who called some JavaScript to Hide/Show/cancel 2 P110_PARENT_SOLUTION_ID text elements, P110_ANSWER_TEXT be part of radio P110_DIRECTORY_TYPE.
DA > settings > Code:
If ($v ("P110_DIRECTORY_TYPE") == 'R') {}
$("label[for=P110_HEADER_TEXT]").text ("name of the root directory")
$x_Hide ('P110_PARENT_SOLUTION_ID');
$x_Value('P110_PARENT_SOLUTION_ID',"");
$x_Hide ('P110_ANSWER_TEXT');
} ElseIf ($v ("P110_DIRECTORY_TYPE") == 'E') {}
$("label[for=P110_HEADER_TEXT]").text ("header text")
$x_Show ('P110_PARENT_SOLUTION_ID');
$x_Show ('P110_ANSWER_TEXT');
} ElseIf ($v ("P110_DIRECTORY_TYPE") ==' no) {}
$("label[for=P110_HEADER_TEXT]").text ("directory name")
$x_Show ('P110_PARENT_SOLUTION_ID');
$x_Hide ('P110_ANSWER_TEXT');
$x_Value('P110_ANSWER_TEXT',"");
}
This works perfectly, however I need to reproduce this code for 2 more areas on the same page. To do this, I created a JavaScript function with 3 parameters and call it in the dynamic action
Page header > Javascript > function and Global Variable declaration:
function ProcessDirType
(I_DirectoryType
I_ParentSolutionId
I_AnswerText
)
{
If ($v (I_DirectoryType) == 'R') {}
$("label[for=P110_HEADER_TEXT]").text ("name of the root directory")
$x_Hide (I_ParentSolutionId);
$x_Value(I_ParentSolutionId,"");
$x_Hide (I_AnswerText);
} ElseIf ($v (I_DirectoryType) == 'E') {}
$("label[for=P110_HEADER_TEXT]").text ("header text")
$x_Show (I_ParentSolutionId);
$x_Show (I_AnswerText);
} ElseIf ($v (I_DirectoryType) ==' no) {}
$("label[for=P110_HEADER_TEXT]").text ("directory name")
$x_Show (I_ParentSolutionId);
$x_Hide (I_AnswerText);
$x_Value(I_AnswerText,"");
}
}
DA > settings > Code:
ProcessDirType
("P110_DIRECTORY_TYPE"
, "P110_PARENT_SOLUTION_ID".
, "P110_ANSWER_TEXT".
);
Her DA stopped working correctly, I tried to replace the parameters with single quotes but not joy.
Can someone give me the correct syntax so that I can make my code more generic and call in three different DA?
Concerning
ADE
I didn't think there would be syntax errors, everything looks good from here. Single or double quotes can be used.
Maybe it's something to do with the way in which the dynamic action is called. Is what event listening? Nothing has been changed in order to manage several regions?
You can add this sort of thing to your javascript to help determine what is invoked and view the output in the javascript console.
console.log('I_DirectoryType:'+I_DirectoryType);
Tags: Database
Similar Questions
-
Dynamic action call javascript to conditionally define read-only elements
Hello
I work with Apex 4.0.2.00.07. I have a form that is used for data entry. If the value of P1_STATUS = 'Order' (P1_STATUS can have the values of "Quote" or "Order") then all the elements cited on the Page (P1_QUOTE_PARTS and P1_QUOTE_LABOUR) are set to read-only.
I tried to put the following code in the action DA "Run JavaScript Code"
$('P1_QUOTE_PARTS').readonly = true;
$('P1_QUOTE_LABOUR').readonly = true;
Not too sure if the syntax is correct.
I'm new to using JavaScript with Apex (not all good books/PDF on using JavaScript with Apex know)
TIAYou seem to have mixed with jQuery syntax and syntax JS for modifyig HTML attributes.
It should be
$('#P1_QUOTE_PARTS').attr ('readonly', true);
-
can the dynamic action call function already?
I have a dynamic action that keeps a total on the screen for two columns of numbers.
Now I need to have a total cumulative where X column > column Y. I don't know if I can do that in an expression javascrip t. I had hoped to call a JavaScript function that returns the value... but the function does not return anything right now.
This could be a thing of syntax sillly - I hope so, but before you spend more time looking for in this I but I would like to ask - is it still possible?Assuming that column1 is apex global table 1(name=f01) and column 2 picture 2 (name = f02).
Name of the item page that show the total operation: P100_TOTAL
Dynamic action
Event: change
Triggered by: jQuery selector
selector: * input [name = f01], input [name = f02] *.
Event type: javascriptvar total = 0; /* Go up untile report table */ var this_table = $(this.triggeringElement).parents('table:first'); /* Loop through each report row */ this_table.find('tr').each( function(){ var colX = ( $(this).find('input[name=f01]').val() == ' ') ? 0 : parseFloat(parent_row.find('input[name=f01]').val() ); var colY = ( $(this).find('input[name=f02]').val() == ' ') ? 0 : parseFloat(parent_row.find('input[name=f02]').val() ); /* Add colX if its greater than Y */ if ( colX >colY) { total += colX; } } /* Assign Page itme with total*/ $s(' P100_TOTAL',total);
-
Dynamic Action condition javascript checkbox.checked count >; 0
Hi all
I'm stuck with a condition of the dynamic action. I have the following:
$("#P302_COMPANY").val () .length > 0 & & ($("#P302_DEPARTMENT").val () .length > 0 | $("#P302_PRODUCT").val () .length > 0 | $("#__P302_INDUSTRY__").val () .length > 0)
What would be nice if all items were areas of text, but P302_PRODUCT and P302_INDUSTRY are the lists box, and I want to check if 1 or more values in the list are checked... but I can not work how to do it... any ideas?
Thank you
TSD
Hi Tod
then three is still fair to say if the element has a checked value?
Yes, but not straight forward. You need a javascript routine that traverses the dom looking for items of type box to the appropriate div, and then, for each item in the loop, set a flag if the checkbox is set (assuming that you only 1 of the total updated check).
Another way would be to create a hidden page element, say P302_PRODUCT_CHECKED, then put a dynamic action on the element of the page P302_PRODUCT with the onclick event and a condition that if the box return value is not null, then the real event will mark the beginning session state (PL/SQL Expression - apex_util.set_session_state) and the value for P302_PRODUCT_CHECKED to say 'Y '. You would need a false event to set P302_PRODUCT_CHECKED to null if the checkbox is not set. You can then test #P302_PRODUCT_CHECKED == 'Y '.
Concerning
Paul
-
The dynamic action of javascript
Hello
Good evening.
I am aware, that we can trigger dynamic actions in multiple ways, based on events of the DOM.
can someone help me triggering a dynamic javascript action.
But not based on events.
Ex: name action dynamic, based on its name or sequence or in any other way.
There are situations where I have to call dynamic measures to avoid hand-written Ajax calls.
Thanks in advance
Hello
The correct answer to this post:
Not sure why the following code lines failed to trigger a dynamic action
$("#P0_SIGNAL").val (123) .changes (); --Also failed
$("#P0_SIGNAL").trigger ("change"); --Also failedThis line would trigger a dynamic javascript action.
Apex. Event.Trigger ($("#P3_TEST_ID"), "change","" ");Steps to make it work.
I need to trigger a dynamic action when a value is set to hidden JavaScript element
P3_TEST_ID is a hidden item.
Create a dynamic action to shoot the P3_TEST_ID change event.
Setting the value of p3_test_id of javascript wouldn't trigger a dynamic action.
Run the following code to fire the javascript DA
Apex. Event.Trigger ($("#P3_TEST_ID"), "change","" ");
-
calling javascript with setting function didn't work!
Hello!
I got a call from IR link column:
JavaScript:TestA1(#Name#)
and a header:
< script language = "JavaScript" type = "text/javascript" >
function TestA1 (txt)
{
Alert (txt);
}
It does not work! (No popup display). But if I change the #NAME parameter # to "asdf" then it works! What can be the problem?
AndrasHello
Call it like
javascript:TestA1('#NAME#')
BR, Jari
-
Code Action run Javascript dynamic Apex 4.1
Hello world
I want to know if there are known bugs on the dynamic Action (the Javascript code to execute).
We did a dynamic action to action "window.open '.
Window.Open ("& RAPPORT_URL_LANCEMENT", "_blank").
But we have a problem. The first time, a blank page opens not mentioned by our URL page.
We also tried to create a branch to our URL by does not open in another window. We want to keep given our open application page.
What we can do for this?
Thanks in advance. Good bye.Is RAPPORT_URL_LANCEMENT a Page or item of the application?
Then, try window.open ($v ('RAPPORT_URL_LANCEMENT'), "_blank").It is a Substitution variable?
Then, try window.open("#RAPPORT_URL_LANCEMENT#","_blank"). -
How to trigger a conditional display based on a dynamic Action without submitting the Page
Hello
Using Oracle APEX v4.2 on 11g, I have the following scenario and wanted to take other people on how to accomplish what I'm trying to do, i.e.:
In region 1, I have a select item list page called P1_SELECTION, which contains selections from drop down to the user to choose from the following three: A1, B2 and C3
In region 2, I have two checkbox elements:
P1_CBOX1 I gave a conditional display of ' point value / Expression 1 column! = 2 expression, where Expression 1 = P1_SELECTION and Expression 2 = B2, so P1_SELECTION! = B2
P1_CBOX2 I gave a conditional display of ' value of the point / column Expression 1 = Expression 2 where Expression 1 = P1_SELECTION and Expression 2 = B2, then P1_SELECTION = B2 .
Use of dynamic Action on the evolution of the P1_SELECTION in region 1, how can I trigger the correct display of the checkbox in region 2, with the default view of the region 2 checkbox being P1_CBOX1, without submitting the entire page, just refreshing each of the elements checkbox to trigger the conditional display correct?
For example, on the changes of P1_SELECTION = B2 then entire submission without page, only P1_CBOX2 is presented to the user in other P1_CBOX1 is displayed.
Is this possible?
Thank you.
Tony.
Hi Tony,.
condition your dynamic action on P1_SELECTION with the following condition of javascript: this.triggeringElement.value = "B2".
Add real actions that will show P1_CBOX2 and hide P1_CBOX1
Add false actions and going hide P1_CBOX2 show P1_CBOX1
Set the dynamic actions to fire on Page load
Kind regards
Erik-jan
-
Hi everyone, I posted this question in the past and made huge strides with the help of Denes Kubicek: https://apex.oracle.com/pls/apex/f?p=31517:294:115851992029365: based on my previous question posted: https://forums.oracle.com/forums/thread.jspa?threadID=2537494
I'm fighting with a single element in my tabular presentation. There is a radio button. The choices all seem correctly, but the value is not saved in the collection (and therefore not recorded in the table). All the other elements in the form of tables to record properly.
Here's what I have for the query. This is element c024 (which maps to;) ("F03'), which is defined as a radio based on an existing LOV LOV.
Currently I have:
2 items on the page:
P110_ID
P110_VALUE
Dynamic action called COLUMN of CHANGE:
event: CHANGE
selection type: jQUERY Selector
jQuery:
Select jQuery = input [name = "f03"], select [name "f08"], select [name = "f09"], input [name = 'f10'], input [name = 'f11'], input [name = 'f12'], select [name = "f40"], input [name = "f21"], input [name = 'f22'], input [name = "f23"], input [name = 'f50']
scope of the event: Dynamics
real action #1: set the P110_ID javascript expression this.triggeringElement.id
real action #2: set the P110_VALUE javascript expression this.triggeringElement.value
action 3: run pl/sql code
declare v_member number; v_seq number; begin v_member := TO_NUMBER (SUBSTR (:p110_id, 2, 2)); select ltrim(substr(:p110_ID,5,4),'0') into v_seq from dual; safis_collections.update_column(v_seq, v_member, :p110_value);
refreshment area true creation #4: LANDINGS_COLLECTION
the tabular presentation is based on the query:
SELECT apex_item.text(1,seq_id,'','','id="f01_'||seq_id,'','') "DeleteRow", seq_id, seq_id display_seq_id, apex_item.text_from_LOV(c004,'SPECIES')||'-'||apex_item.text_from_LOV(c005,'GRADE')||'-'||apex_item.text_from_LOV(c006,'MARKETCODE')||'-'||apex_item.text_from_LOV_query(c007,'select unit_of_measure d, unit_of_measure r from species_qc') unit, apex_item.select_list_from_LOV(8,c008,'DISPOSITIONS','onchange="getAllDisposition('||seq_id||')"','YES','0',' -- Select Favorite -- ','f08_'||seq_id,'') Disposition, apex_item.select_list_from_LOV(9,c009,'GEARS','style="background-color:#FBEC5D; "onFocus="checkGearPreviousFocus('||seq_id||');"onchange="getAllGears('||seq_id||')"','YES','3333','-- Select Favorite --','f09_'||seq_id,'') Gear, apex_item.text(10,TO_NUMBER(c010),5,null, 'onchange="setTotal('||seq_id||')"','f10_'||seq_id,'') Quantity, apex_item.text(11,TO_NUMBER(c011),5,null,'onchange="getPriceBoundaries('||seq_id||')"','f11_'||seq_id,'') Price, apex_item.text(12, TO_NUMBER(c012),5,null, 'onchange="changePrice ('||seq_id||')" onKeyDown="selectDollarsFocus('||seq_id||',event);"','f12_'||seq_id,'') Dollars, decode(c013,'Y',apex_item.text(14, c014,30,null,'style="background-color:#FBEC5D;" onClick="onFocusAreaFished('||seq_id||');"','f14_'||seq_id,''),'N','N/A') Area_Fished, decode(c017,'Y',apex_item.text(18, c018,4,null,'style="background-color:#FBEC5D; "onBlur="setUnitQuantity('||seq_id||')"','f18_'||seq_id,''),'N','N/A') UNIT_QUANTITY, decode(c017,'Y',apex_item.text(19,'CN',3,null,'readOnly=readOnly;','f19_'||seq_id,''),'N','N/A') UNIT_COUNT, c024 hms_flag, decode(c050,'Y',apex_item.checkbox(21,'Y','id="f21_'||seq_id||'" style="background-color:#FBEC5D; " onClick="alterYes('||seq_id||');" onKeyPress="alterYes('||seq_id||');"',c021),'N','N/A') FinsAttached, decode(c050,'Y',apex_item.checkbox(22,'N','id="f22_'||seq_id||'" style="background-color:#FBEC5D;" onClick="alterNo('||seq_id||');" onKeyPress="alterNo('||seq_id||');"',c022),'N','N/A') FinsNotAttached, decode(c050,'Y',apex_item.checkbox(23,'U','id="f23_'||seq_id||'" style="background-color:#FBEC5D;" onClick="alterUnk('||seq_id||');" onKeyPress="alterUnk('||seq_id||');"',c023),'N','N/A') FinsUnknown, decode(c050,'Y',apex_item.textarea(28,c028,3,null,null,'f28_'||seq_id,''),'N','N/A') Explanation, decode(c024,'N',apex_item.select_list_from_LOV(29,c029,'HMSNATURE','onchange="saveNature('||seq_id||')"','YES','A','-- Select Nature of Sale --','f29_'||seq_id,''),'U',apex_item.select_list_from_LOV(29,c029,'HMSNATURE','onchange="saveNature('||seq_id||')"','YES','A','-- Select Nature of Sale --','f29_'||seq_id,''),'Y','N/A') Nature_Of_Sale, decode(c020,'Y', apex_item.select_list_from_LOV(40,c040,'HMS_AREA_CODE','style="background-color:#FBEC5D;"',null,null,null,'f40_'||seq_id,''), 'N','N/A') HMS_AREA_CODE, c020,c050, decode(c020,'Y', apex_item.text(41,TO_NUMBER(c041),5,null,null,'f41_'||seq_id,''), 'N','N/A') Sale_Price from apex_collections where collection_name = 'SPECIES_COLLECTION' order by seq_id
I noticed the following:
When I change the column C011 (price) the following values are defined in dynamic action:
P110_ID = f11_1
P110_VALUE is everything that I change the price.
When I change the column C024 (hms_flag), the following values are defined:
P110_ID = f03_0001
P110_VALUE = change everything what I hms_flag to.
the region is updated in my dynamic action, and change of hms_flag does not take. I tested the SQL query that generates the value of v_SEQ in the dynamic action. Both a change of price and HMS_FLAG, it seems valid
Select ltrim (substr(:p110_ID,5,4),'0 ') in the double v_seq;
If f11_1, v_seq: = 1
If f03_0001, v_seq: = 1
Thank you!
solved. sort of.
domain c024 references f03.
dynamic ACtion, step 4 calculated v_member as a substring of P110_ID... and in all other areas, the column and the field (fxx) displayed the same value... otherwise c024.
I'm not exactly sure how solve it, but see the problem.
-
Hello world
I have an application page that contains a lov (gears). If a particular device is selected, I want to hide other fields. The value of the machine could be one of many. I created a dynamic action using javascript... but I'm really not familiar with javascript and can't seem to make it work. Note, there is a line below commented that compared to gear to the value of "500". This line works and mask fields... but I need to make it work for all possible values. Any help would be really appreciated!
Thank you, Karen
var no_size is ["000", "300", "320", "400", '500', '501', '550', "620", "630", "650", '662', '700', '750', '760', "803", "811"];.
$(". {Gear") .each (Function (index)}
If ($v (this) == '500')
If ($.inArray ($v (this), $no_size)) >-1
{
var rowTR is $x_UpTill (Thi, 'TR');.
$(rowTR).find(".) G_SIZE"). Hide();
$(rowTR).find(".) Stretch"). Hide();
$(rowTR).find(".) Mesh"). Hide();
}
});This seems to do the trick.
var no_size is ["000", "300", "320", "400", '500', '501', '550', "620", "630", "650", '662', '700', '750', '760', "803", "811"];.
$(". {Gear") .each (Function (index)}
If (no_size.indexOf ($v (this)) > - 1).
{
var rowTR is $x_UpTill (Thi, 'TR');.
$(rowTR).find(".) G_SIZE"). Hide();
$(rowTR).find(".) Stretch"). Hide();
$(rowTR).find(".) Mesh"). Hide();
}
on the other
{
var rowTR is $x_UpTill (Thi, 'TR');.
$(rowTR).find(".) G_SIZE"). Show();
$(rowTR).find(".) Stretch"). Show();
$(rowTR).find(".) Mesh"). Show();
}
}); -
custom not pulling dynamic action
Using Apex 4.2.2 on 11g
I have a standard report A1
There is a link to the A1 report column which updated the action dynamic table C1 using a custom.
The link of the report A1 column has the value javascript URL: $.event .trigger ('RefreshTrend_2', [{key_2:' #COL01 #'}]);
and there is a dynamic action RefreshTrend_2 D1, which sets the value of the graphic filter P17_KEY_2 to the value of the key_2 variable javascript and then refresh table C1
Dynamic action is customized with a type DOMObject of the document and no condition
It works fine, but when I add another combination of State/chart (report A2, table C2) with a similar dynamic action (D2), D2 is a copy of D1 with the values for the variables and chart area has changed.
The A2/C2 feature works very well on its own, D2 is fired when I click on the link in the column, but not when there are 2 dynamic actions customized / document on the page.
This column on A2 link triggers the dynamic action D2 if dynamic action D2 contains a higher than D1 sequence (if I move over D1 in the list, it will trigger, but then D1 will not fire for the link in the column on the A1)
Am I missing something?
Thank you
Kathryn
It turns out that dynamic action set to fire on the loading of the page made reference to a javascript variable not defined (page element is not filled yet at the time of the loading of the page), so everything after that is ignored and the second dynamic action does not occur.
I turned off the fire on loading the page for dynamic and all actions work
-
dynamic action... How to make date is always before the "to date".
Hello
using a form, I ask my users to provide the dates...
can I know (step by step) how to set up a dynamic action so that if it dates back to article P20_FROM_DATE after P20_TO_DATE then an error message to be generated...
Thanks in advanceOK, let's start again. Delete your current setup you date pickers and try these.
P22_FROM_DATE settings
Display on focus
View other months YesUse the same settings for P22_TO_DATE.
Create a dynamic Action called say, Compare the Dates
Event Before the Page is sent
Condition Expression of JavaScript
Value $v(P22_TO_DATE')<>Real Actions
Action Draw the attention of
Fire when the result of the event is True
Text The date cannot be less than this day.Another real Action
Action Update fixed
Fire on the loading of the Page Checked
Assigned to elements Selection type Article (s) P22_TO_DATEJeff
-
Confirm the dynamic action does not not as expected in the APEX 4.2.5
This looks like a bug in APEX 4.2.5. I have a page with a "Cancel" button that redirects to another page. There is a dynamic action that fires on the button with a confirmation action and the text ' are you sure? However, if the user selects OK or cancel in the confirmation dialog box makes no difference - the redirect is always performed.
I found this question after the migration of a page that worked to 4.1.1-to-4.2.5.00.88 APEX and were also able to replicate on apex.oracle.com here:
https://Apex.Oracle.com/pls/Apex/f?p=19896:2
(Press the Cancel button in the top right of the page redirects to page 1, regardless of the user's response to confirm the popup.)
I don't need someone to suggest the alternative code, I know how to build my own confirmation processing. I want to just raise this as a bug as possible and see if there is a solution to make the dynamic action works as it should.
NB I found this in the patch notes for 4.2.5.00.88 on a fix for a similar problem:
15984978
Dynamic action front-Submit with a confirmation message does not
Hi Tony,.
I think the problem is that the action of the button is defined as 'Redirect page in this Application', but it must always be "defined by the dynamic Action" as soon as you have set dynamic actions 'click' to a button. Normally, which is automatically changed as soon as you create your first dynamic action of a button, and I just confirmed by creating a test button in your application that has been defined as «Redirect...» ». After that I created a dynamic action the action of the button is set to "defined by the dynamic Action.
Is it possible that you have modified the action of the back button to «Reorient...» » ? The question why «redirect...» "does not work, it's that we cannot guarantee in what order the browser will process click on events defined with onclick in the tag button itself and those events attached as a click event handlers. This is why it is necessary that everything is defined as dynamic actions. Only in this case you will be able to cancel the treatment.
Concerning
Patrick
Member of the APEX development team
My Blog: http://www.inside-oracle-apex.com
APEX Plug-Ins: http://apex.oracle.com/plugins
Twitter: http://www.twitter.com/patrickwolf
Post edited by: Patrick Wolf
-
Show / hide the dynamic Actions does not work in Windows 7 IE10 and APEX 4.2.1
Hello
I have a page in the APEX 4.2.1 reactive Blue theme, where show or hide page elements based on changes to other page elements and their values, in terms of JavaScript expression.
It's that everything works well in Chrome 31.0.1650.63 m and 25.0.1, Firefox but not Internet Explorer 10. I thought it might be linked to this solution to the problem of Ajax IE10 | Code of Jason and tried their recommendation, but appears not to have contributed.
Help please!
Thank you
Alex.
I found the problem and it was my fault. One of my dynamic actions using JavaScript expression conditions was missing quotes in $v ("P1_ITEM1"), breaking the rest of the related JavaScript code. Chrome and Firefox did not care, but IE seems to be less tolerant of mistakes like that.
Scott, thanks anyway. It is useful to know that I have that option as well.
-
Level elements dynamic Actions and application
Request Express 4.1.1.00.23
I searched everywhere for an answer on this one and I can't seem to find it. Is it possible to have a dynamic action to interact with an element of application level? If it is possible, is able to have the value field in the when a dynamic action article contains a comparison operator?
An example of a real case would be:
Element level application F111X = X
Dynamic action on P4_Item is triggered and disables the field
Case of falsification:
Element level application F111X = Y
Dynamic action on P4_Item is not triggered and the field remains active.
Thank you
JonJon,
I'm looking for an example, and if I use your article page P4 in the box 'When', event could be the change, Type of selection would be the page element.
P4 would be selected in the drop-down list item (s), Condition would be equal to and value would be TEST with NO quotes!It is difficult for me to know when the values of the quote and when not.
What is it?
Howard
Maybe you are looking for
-
How to configure rules? I can't get it work
I tried following the instructions but when I click to send mail in the selected folder, nothing happens.I have to be able to get the rules to work if I will continue to use Thunderbird
-
My Skype is getting crashed during the chat. Please see attachment
-
Do I need to allocate a CAL for a service account?
Hi, a small question hopefully. I have a large number of R2 2012 Windows servers running a variety of applications in all of our field. What I was asking is do I need a CAL for each service account? I understand that the calluses are either user or
-
Windows Installer runs when trying to open any program
original title: Installer windows continues execution to restore computer to 10 days ago.very hard do.have vista 64 svc pk 2 4 gig memory 4 fifths free. This happened after my system came down very shortly after that I used Mr. fixit to sucessfully
-
How to install Vista on a pc without a CD ie., netbook player?
How to install Vista on a pc without a CD ie., netbook player?