Conditionally show/hide Region Display Selector items - oracle-apex-5.1

I have two regions on the page with the same title, so I cannot use APEX hide region dynamic action and forced to use javascript.
Both regions are part of Region display selector.
I gave each region different static ID - Region`` andRegion2`.
I am hiding a second region and displaying the first one using javascript dynamic action:
$("#Region2").hide();
$("#Region1").show();
The thing is, both regions are still accessible via Region Display Selector. How can I hide one of the regions from the display selector?

I would try these options in that order:
1 - Put these regions inside a "container" region, this container region is "blank with attributes". You need to control this container region in the selector and not the two childs.
2 - This control, show or not show, can not be done as a server-side condition?
3 - Define a static id of these regions and use hide() or show() to do this.
And you can access your respective tab like this.
Example:
//alfa4 is the static ID of my region report
$("li[aria-controls='SR_alfa4']").hide()
$("li[aria-controls='SR_alfa4']").show()
You can test in this page: https://apex.oracle.com/pls/apex/f?p=145797:12

Related

Oracle Apex create a form that is split into multiple regions

I have a merchant application form that I want to split up into multiple regions so that the user only has to see one section of the application at a time. Each region is tied to the same table therefore:
Each region would have to share the same primary key
I only want one submission of the form items at the end of the form
I read this post Create an Apex form with multiple pages
which makes it seem like an easy to do process by using the Hide and Show Region template and manually separate the form into multiple regions. The problem I'm running into is that Apex requires a primary key to be tied to each form region, but you also can not have duplicate items on the same page. Any ideas?
-- attaching the PNG of the error message here Primary Key ERR
To me, it looks like a single page with several regions. Doing so, you'd have only one primary key item.
Logically, you'd separate items into different regions. Each of them should use its "Server side condition" which would decide whether to render (i.e. display) that region at certain time or not. It means that it doesn't have to be a hide and show region (besides, it is always here and visible, user just decides whether to reveal its contents or not). You'd create any region type (even an ordinary HTML region).
For example:
the first region displays customer ID, name and address. Other regions are "hidden" because e.g. P1_ID IS NULL is met as no data has been submitted yet. Once user enters ID, name and address and submits the page, P1_ID gets its value which enables other region(s) to be displayed
the second region contains items about some other customer's data; it is now visible because P1_ID is no longer NULL, but 3rd region is still hidden as you didn't enter some required data in the 2nd region which would let the 3rd region to be displayed.
and so forth
Note that the post you are referring to is 6 years old. That is like medieval in apex terms - so much has changed since then.
This is a way to do it if you want multiple pages. Just create multiple pages with the same form (using the create form functionality) and depending on the functionality needed on a specific page you delete the page items you don't want to show. If a database column is not included in the form it will not be touched by the dml process. This should be relatively simple to create.
Note: if you want to get up to speed on forms, read this blog

How to hide a region and unhide it on a button click in Oracle apex?

I want to hide a region and unhide it on a button click in Oracle apex, but its showing an error on false action that in when condition nothing is defined.
Can anyone please help me regarding this.
Regards,
Anshul Ayushya
A simple way to do that is to create two buttons: one to hide a region, and another to show it.
create them using default settings; nothing special
create dynamic actions for both of them
"Hide" button should have the "hide" action, it affects a "region" whose name is selected from the list of available regions
"Show" button should have the "show" action, it affects a "region" whose name is the same as for the "Hide" button
Run the page and enjoy in hiding/showing the region.
You could have a look at collapsible region.
Create a region, Appearance needs to be set to Collapsible (you can configure the options right below in Template Options). Some types of regions do not offer Collapsible (e.g. Interactive Report), but then you could just create a static content region, make it collapsible and create a subregion of the desired type. And you are done.
If you only want to have one button for showing/hiding the region, you might also use jQuerys .toggle() function. For that, add a static ID to your button and create a dynamic action with a JavaScript action that runs the following:
$("#<<STATIC_ID_OF_BUTTON>>").toggle();
This will hide/show your region on every click of the button. To load the region hidden, just add the following CSS for the region:
#<<REGION_STATIC_ID>>{
display:none;
}
With .toggle() you can also add options, such as defining a function to execute once the toggle actions has completed or the duration of the toggle animation such as:
$("#<<STATIC_ID_OF_BUTTON>>").toggle({
duration: 400,
complete: () => {"do someting here"}
});
See the jQuery documentation of the .toggle() function for a full list of options.

APEX: Charts in Tabs Container not visible

I have in APEX a 'Static content' region. This has the template 'Tabs container'. As subregions (or 'tabs' as it is called within this template) I have multiple charts. The problem is that just the chart of the active tab is displayed correctly. When selecting another tab, the chart within the selected tab is not display. I have to resize the browser window, then the chart is displayed.
I'm using the default APEX Theme (42) without changes.
Is this an APEX bug or am I doing something wrong? If this is bug, is there a workaround?
Link to question in Oracle Community Forum: https://community.oracle.com/thread/3947770?sr=inbox&ru=289068
Thanks for your answers,
Peter
I solved this error by the following two steps:
Replace the Tab Container region with a Region Display Selector region. This region is like a tab menu. All regions that should be shown in the tab menu need to have the flag 'Region Display Selector'. All the regions that are handled by the Region Display Selector should be on the same hierarchical level as the Region Display Selector.
The main error still exists but for Region Display Selectors, APEX fires an event for which you can write a handler:
$(document).ready(function() {
$('.apex-rds').data('onRegionChange', function(mode, activeTab) {
$(window).trigger("apexwindowresized");
});
});
The handler fires an event that the browser window size has been changed on which the charts automatically act and redraw everything.
This should also work for the Crousel Container. A big thanks goes to this blog entry: https://apexplained.wordpress.com/2016/05/02/working-with-region-display-selectors-in-apex-5-0/

Create an Apex form with multiple pages

I'm trying to make an apex form that has multiple 'pages' within it, so that I can achieve a nice layout.
For example:
Page 1 - Personal Details >> Page 2 - Occupation >> Page 3 - Career History >> Submit
Is there a way to do this without submitting one page at a time as this would mess up my validation for the table entry.
It's kind of a broad question - lots of possible solutions. You will need to create several regions on the page, so that you can easily show or hide different sets of page items without submitting the page.
If you simply want to keep the page tidy, you could make use of the Hide and Show Region template, or you could create a Region Display Selector region.
To help the user experience flow a bit better, I would probably do something like this:
Set up the page items using the Form wizard.
Create three HTML regions - Personal Details, Occupation, and Career History.
Move the page items into the appropriate regions.
Delete the original region created by the wizard, together with the default buttons.
Create navigation buttons in each region - probably a Next button in Personal Details, Next and Previous buttons in Occupation, and Previous and Submit in Career History.
Create dynamic actions for each of the buttons. The Submit button submits the page of course. The Next and Previous buttons show and hide the regions as appropriate.

Marionette Layout object to render tab content

I have a region in which I need to have a tabbed view (simple) however if I want the tab content to be differently layout - not sure how to achieve it. I can create different layout with multiple region and corresponding view, but how do I attach this to tab content, given that applyout can only be attached to region? Or can this be attached to one of the div of tab-content using $el?? Need some pointers.
Not sure I entirely understand your question.. But here goes.
I have implemented a navigation component where I can pass a tabsCollection and region. It will set up a region for the content and a list of tabs above it. When a tab is clicked it will fire the callback on the model in the tabsCollection which can be used to display what ever content you want.
There are more complex ways to handle this to allow for caching of a tabs content. But basically using a Backbone collection for the tabs with their own function for displaying content will do the trick.

Resources