Dynamic action call javascript to conditionally define read-only elements
HelloI 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)
TIA
You seem to have mixed with jQuery syntax and syntax JS for modifyig HTML attributes.
It should be
$('#P1_QUOTE_PARTS').attr ('readonly', true);
Tags: Database
Similar Questions
-
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);
-
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","" ");
-
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);
-
Advanced table read-only elements
Hi all
How elements Message choice and Message check box in Advanced Table read-only via code?
OATableBean oatablebean = (OATableBean) oawebbean.findIndexedChildRecursive ("ItemsTable");
oatablebean.findIndexedChildRecursive("Type").setDisabled (true);
cause compilation error.
setRendered works. How to define the need, read only properties through code?
Thank you
KumarHello
Try like this
OATableBean oatablebean = (OATableBean)tab.findIndexedChildRecursive("ItemsTable"); OAMessageChoiceBean messageChoiceBean=(OAMessageChoiceBean)oatablebean.findChildRecursive("Type"); messageChoiceBean.setReadOnly(true);
Ajay
-
How to make a conditional field read-only
Hello
There is a field "Date to close." I need to check if the date today and the "closing date" is located in the same quarter. If Yes, then, a particular field must be made editable otherwise not.
(Better, if it could be done by using the properties of the user business component)Try this...
Create a calculated field 'Qtr RO' and set the value as
IIF (JulianQtr ([end Date]) = JulianQtr (Today ()), "N", "Y")
and assign the property use business for the field "Qtr RO"
I hope this works.
-Siebelade
-
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.
-
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"). -
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.
-
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
-
Dynamic action on the fields of forms in table form
Hello guys.
That I can see on the form fields in a table, I can't perform dynamic actions. What I want is to have an element of the selection list when in the change event, it changes the values for all the records in the report. For example if I have 40 records in this tabular form and I change the value of 'Open' to ' near the field called State, I want to see this change (status value of 'Open' close ') all rows in this tabular presentation. Is this sensible?
Thank you very much, Bernardo.
Hello Bernardo.
There are several ways to accomplish what you want.
-You can create a PL/SQL procedure to manage an update on all the rows according to the value of the value of your column. I wrote once a blog that can help you with that:
http://vincentdeelen.blogspot.nl/2013/06/custom-multi-row-processing-using.html
-You can create a dynamic action with javascript or jQuery to handle the change event.
The first option is more secure because it is managed by the database, the second is more simple and example adjustable all the entire column for all rows displayed, without the need to refresh your tabular presentation, or your entire page. For course work, you should however have little validation at the end of the database. I also think that it is not possible to set the values of the rows that are not displayed, which would again require some PL/SQL for handling.
If you need help setting up the dynamic action, please set up an example on apex.oracle.com.
Kind regards
Vincent
-
I have two dynamic actions for an item from the selection list that is loaded from an element of Cascade LOV.
Dynamic action 1:
Name: d1
Condition: Value = "EXPECTED".
true action: see the 'Solution' element.
action of false: hide a 'Solution '.
Dynamic action 2:
Name: d2
Condition: Value = 'OFFERED '.
true action: see the 'Solution' element.
action of false: hide a 'Solution '.
That's happened? If only works with the dynamic action of d1 or when I did some changing works with dynamic action of d2. I unchecked the field "load fire on the page" but it did not work. I think that there is perhaps some collide with them but I analyzed it, but I can't find. Thanks in advance.
Another thinks I want to ask is how to order values in a select list... with this code above indicate me the values in the following order: closed, lift, open, waiting. But I want the values in the following order: open, pending, climbing, closed. How can I do?
Best regards, Bernardo.select distinct STATUS as display_value, STATUS as return_value from HD_STATUS order by 1
Ah so. It's actually easier then.
You'll have an installation DA your d1 is configured with the following differences:
Name: d1 Event: Change Selectio type: Item(s) Item: P10_SUBSTATUS Condition: Javascript expression Value: $v('P10_SUBSTATUS')==='PLANNED' || $v('P10_SUBSTATUS')==='OFFERED' true action: Show "Solution" item, false action: Hide "Solution" item. Nothing in the Condition box that currently has the PL/SQL expression. (Make sure to select "None" as the condition type in the condition box)
You need basically the GOLD option that is provided above as Javascript. ' | ' is the operator or if you are not familiar with JS. ' = ' means exactly equal to, and possibly "==", equal to so you could also put it this way.
Should have thought first of this route.
Published by: Bob37 on June 28, 2012 16:15
-
Dynamic action - check if the size of the texfield values does not exceed limit
Hello
I have a form and I'm trying to use dynamic Action to process the form values. I don't know how to get the length of the value of a textfield and compare to what I said in the values
The order of the day called P6_USERNAME which can be more than 10 characters long.
So I tried to create a dynamic Action with the following parameters in the region when .
EVENT: Press button
SELECTION TYPE: jQuery Selector
jQuery SELECTOR: $("P6_USERNAME").val () .length
CONDITION: above
VALUE: 10
Of ACTION GENUINE, I had a view only showing a message "you have exceeded the limit.
The above didn't work and tried to work it around with:
$v("P6_USERNAME").val () .length
that no longer works.
Any suggestions on how I can achieve this? The only options I got in the Type of selection are: point, area, object DOM and jQuery Selector. What I'm really after is retrieving the value of the element, so I can use it for comparison with the value to run my Real Action
APEX 4.0 - Oracle XE 11 G - Windows 7 32 bitIt is not necessary to use a validation/dynamic action. Set the maximum width for the element attribute and the browser will prevent users to enter values longer than that.
-
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();
}
}); -
Dynamic Actions disable button based on the text field
Hello
Sorry if this has already been asked but I checked and could not find a job.
«I'm trying to disable / enable a button "view" among the elements of this region from if a text field has a value or.» I created a dynamic action for this but its not working only partially. I can get the button to be disabled or enabled when I leave the text field, but what I'm trying to do is to get the State of button to change as soon as I start to type in the text field or return to people with disabilities if the text is deleted.
I don't know that I'm missing something simple and help you can give is greatly appreciated.
I use APEX 4.1 and that's how I got the dynamic action implementation, I tried different but no event types to give them action I want.
I also install an example (details below)
Event - change
Selection type - point
Article (s) - P1_TEXT
Condition - is null
Real Action
Action - disable
Fires when the result of the event is - real
Fire on the loading of the Page - Y
Items affected - button
Article (s) - P1_BUTTON
Action of false
Action - Enable
Fires when the result of the event is - fake
Fire on the loading of the Page - Y
Items affected - button
Article (s) - P1_BUTTON
workspace - show_issue
user_name - show_issue
password - show_issue
app_id - 61707
http://Apex.Oracle.com/pls/Apex/f?p=61707:1
It works as expected if you change the event of 'Change' for 'key version?
Maybe you are looking for
-
Swap ATI 2600 Pro w/2400?
Hello I have an iMac mid-2007 with an ATI Radeon 2600 Pro. The system has been great! Unfortunately, yesterday I thought he was asleep, but it is a black screen I did everything I could find online - command/option/r/p...power off the power, unplug,
-
PA3370 Bluetooth SD Card 3 / Vista
Greetings. I have a laptop Toshiba P25-S526 and a Bluetooth SD PA3370 adapter. Have used this combo for awhile with Windows XP Home edition. Under Vista, however, I am having no luck. I downloaded the latest Toshiba BT stack, but when I go through th
-
HP Envy 700-500z: Question about wi - fi antenna tower for the wi - fi signal booster
Hello I bought a wi - fi turn antenna to boost my wireless signal so I can use my Tablet outdoors during the summer. The instructions provided with the said Tower if the computer has built in wi - fi or wireless card, do not install the antenna towe
-
My saved Inbox messages disappeared and it is said that it is downloading new messages, but then stops and gives me the abov error message: Protocol: Pop3.Port 110.Secure (SSL): No.ErrorNumber:0x800co:33 Can someone please help?
-
Explorer.exe does not start automatically
HII, When I restart my laptop is wrong on the desktop whenever I need to run explorer.exe thru new task (from the Task Manager)I also put explorer.exe at startup option still i m facing the same issue.How to solve this problem?