Using Dynamic Action for multiple checkboxes - oracle-apex

In Oracle Apex, I am currently creating a form. Within the form there is a checkbox item that shows a LOV. One of the options is labeled 'others'. The goal is to have a text box appear when 'others' is checked. I am unsure on which dynamic action to use for this situation. Could someone help me with this?

If built in dynamic actions in apex wont give you results, you can always patch it up with a jquery or javascript in the main page.
In the main page under javascript>excute when page loads, try this code
$('#P2_NEW_CONTAINER').hide();
$('#P2_NEW_1').click(function(){
if ($v('P2_NEW_1').indexOf('2') != -1) {
$('#P2_NEW_CONTAINER').show();
}
else{
$('#P2_NEW_CONTAINER').hide();
}
});
where
P2_NEW_CONTAINER is the id of the container of your textbox/textfield.it always end with _CONTAINER;
P2_NEW_1 is the id of your checkbox and;
"2" is the return value of the "others" check box

Create text field lets say P1_textthen create a dynamic action with the following options:
Event=Change
Item=P1_Your_Check_Box
Condition=In List
Condition Value=others (the return value of your P1_Your_Check_Box when
others is checked)
True Action=Show
Uncheck Fire On Page Load
Affected Elements>Items= P1_text
False Action=Hide
Affected Elements>Items= P1_text
Check Fire On Page Load

Related

How to give link for 3 different URLs on single button using select list in oracle apex

If user selects one option from select list then that button should link to different URL, if user selects second option from that select list then that same button should land at another URL , Kindly help me in it using ORACLE APEX.
Create a page item P1_URL of type select list
Add a couple of entries - for this example I'm using static values but a query should work too. Make sure the return value of the entry contains the actual url:
Create a button with action "Submit Page"
Create a branch
Execution Options > Point > "Processing"
Type: "Url defined by Item (Redirect)"
Item: P1_URL
Run the page, when you click the button the page should redirect to the selected url.

APEX - double click on interactive gird

Below is my interactive grid. It shows data from v$sql_monitor view based on sql_id from list .
What I would like to do is to create double-click dynamic action on a record. This action would open new modal dialog and pass two parameters : 1. sql_id from list above 2.sql_exec_id from clicked record. Would you give me a few hints how to do it ? I guess a piece of Javascript code will be necessary :(
There are multiple options to do this - here is one way, by using javascript custom events. I created a sample with an IG on the EMP/DEPT sample dataset with page 88 as IG and page 90 as modal. The column ENAME is a link to page 90 that sets a column value and a page item in the link.
Page 88 has an IG and 2 page items:
P88_PAGE_ITEM (a value entered on the page like the list in your screenshot)
P88_ENAME (to hold the selected report column value
Page 90 has 2 page items: P90_PAGE_ITEM and P90_REPORT_COLUMN
Create IG on page 90 on table EMP
On column ENAME, add the following under "JavaScript Initialization Code"
function(config) {
config.defaultGridColumnOptions = {
cellTemplate: '<button type="button" class="t-Button t-Button--link my-ename-js" data-ename="&ENAME.">&ENAME.</button>'
};
return config;
}
This is a button of type "display as link", created with the universal theme button builder that has 2 extra attributes: a class my-ename-js and a data attribute "ename" data-ename="&ENAME."
Create a dynamic action to capture the click and set the page item:
Make sure to set the scope to "Dynamic". This is needed because the event listener needs to be added again after a dom change (a search or filter of the IG).
add a true action of type "Set Value" to set the value of P88_ENAME to the value of the selected row
add a second true action to trigger a custom javascript event:
Create a dynamic action of type "Event: Custom" to capture the custom event triggered in the previous DA.
add a true action of type "Submit Page". Note that "Show Processing" needs to be unchecked.
Almost there. One last thing is to create a branch to the modal page:
Create a branch (process point "After Processing") with server-side condition of "Request = Value" with value OPENMODAL and link attributes below:
And this should be the result:
Well, I modified a bit your scenario.
I added new SelectList P88_FILTER
and added dynamic action ON_CHANGE :
with action
I modified source if IG:
These changes allowes me to filter IG . In our case filter returns always only one record like below.
and now my problem begins. In your scenario clicking the link "ename" updates field P88_ENAME and opens modal dialog with proper values. After my modification neither P88_ENAME updates nor modal dialog opens :(

Oracle Apex Checkbox Group, disable item option

It is possible to disable one option of checkbox group? I have created an P100_CREATE_PT item and disable one option using JavaScript:
const nodeList = document.querySelector("#P100_CREATE_PT_0");
if(nodeList) {
nodeList.disabled = 'disabled';
nodeList.checked = true;
}
But there is one problem: after page submit Checkbox Group item is null (undefined), but if disabled option is not set - item is not null, is okay. Where is problem?
In details: I have P100_CREATE_PT Checkbox Group Item with 3 options. In block JavaScript: Execute when Page Loads, I'm running JavaScript code, when page is loaded, first Checkbox Group option been disabled and checked - that what I need. When page submitted using button, Procesing runs the code: APEX_ERROR.ADD_ERROR(p_message => :P110_CREATE_PT, p_display_location => APEX_ERROR.C_INLINE_IN_NOTIFICATION); and showing error message with empty value (P100_CREATE_PT). And there doesn't matter how many options selected. If option is not disabled, P100_CREATE_PT value been not null.
I can confirm that this doesn't work if the disabled value is the first checkbox. On page submit it does not set the value of the checkbox.
However the value is sent correctly in an on-change dynamic action.
So a workaround is to set a hidden item on change of the checkbox and use that in the page submit.

Not able to make the navbar items dynamic in ember

I have navbar component which I have placed in an application.hbs so that it should be visible always.But I want to change the title of the navbar with each page I visit ( say I am on index page it should say "Home" , if I am on profile page it should say profile,etc).Right now what is happening is navbar title always remains "Home" for all the page.This is happening because the navbar gets rendered onlu during the time it loads the page in browser and after that it doesn't change according to page.
application.hbs
{{top-navbar dp_url=model.profile.dp_url first_name=model.profile.first_name title=title}}
{{outlet}}
Here the I am computing the value of title depending upon which page the user is.
application.js(controller)
if (currentPage === "" || currentPage === "#"){
currentState.set('title',"Home")
}
else if(currentPage === "Userprofile"){
console.log('myStudio');
currentState.set('title',"UserProfile");
}
In here the currentpage has the current url of app and I am comparing it and deciding the value of title for navbar.
But the top-navbar title value gets calculated only for the first time when user load the app in browser and not when I move ffrom one route to another.
I have also tried the Ember.Evented but not able to solve it.
I don't know what Ember.js and Ember-data version are you using, currentState is deprecated since 2.1, anyway looks like you're using a private method intended for Ember internals and not meant to be used in an application.
A possible (but maybe unnecessary complicated) way to accomplish what you want is:
Create a model with the information you want to mutate in the navbar (e.g. navbar-data).
In the route where the navbar is rendered, create and return a record for it using a fixed numeric ID (e.g. store.createRecord('navbar-data', { id: 1, title: "index" })).
Pass the created record to the component (instead of just a string).
Whenever you want to change, peek the record with store.peekRecord('navbar-data', 1) and change the value you want to change in the navbar.
Of course, the record you use for that must not be saved with record.save().

Calling jQuery on Oracle Apex IRR partial page refresh

Based on another question I have asked:
How to Remove <a href> Link Tag for a Specific Value using Jquery
where I need to remove the a href tag if the value is 'N'.
All works fine on first load, but since I am using an Oracle ApEx Interactive Report (IRR) and perform a partial page refresh, the solution from my other thread doesn't fire again and so all my values that have a value of 'N' now have a link below it which is not want I want.
Within an IRR, is there a means of firing jQuery code, like on load when the report is partially refreshed, based on column filtering?
Sure is.
With dynamic action: After Refresh
Triggering region: select your IR region
True action: execute javascript code
$('a', this.triggeringElement).filter(function(){
return this.innerHTML === 'N';
}).replaceWith('N');
Or just javascript code
$("#ir_region_id").bind("apexafterrefresh", function(){
$('a', this).filter(function(){
return this.innerHTML === 'N';
}).replaceWith('N');
});
Although you might want to restrict your "a" selector to your actual link column. If you don't, every link in the IR region is selected. It's unnecessary.
$('td[headers="my_link_column"] a')