I'm trying to figure out a way to disable tabs based on a value passed to an item on the tab page. Is there an easy way I can do this or can someone point me to an example I could use?

asked 28 Jul, 12:11

walkerdog's gravatar image

accept rate: 16%

edited 31 Jul, 14:40

FOEX-SUPPORT's gravatar image


Hi there. Could you please elaborate a bit? How exactly are you setting the value, what kind of field is it?

(31 Jul, 03:58) FOEX-SUPPORT FOEX-SUPPORT's gravatar image

I set the hidden item on the main page from a content loader page. The main page contains the tabs.

(31 Jul, 08:59) walkerdog walkerdog's gravatar image

Your error message has something to do with an unavailable variable.-->
The onchange event is triggerd before the other hidden item value is set. You can use a FOEX Delay true action before the function call.

If it's feasible for you using a hard coded Parent Region, use the following version of the function (we did that already in your test case):

function disableTab(id, disable) { var p = Ext.getCmp('PR_CONTENT_LOADER_TABS'), allTabs = p.items; allTabs.each(function(tab) { if (id == "ALL") { tab.setDisabled(disable); } else if(tab.getId() == id) { tab.setDisabled(disable); return false; } }); }


answered 04 Aug, 04:40

FOEX-SUPPORT's gravatar image

accept rate: 32%

Thank you for help in resolving this. This works great.

(04 Aug, 09:33) walkerdog walkerdog's gravatar image

Currently there is no declarative way to do this - we have filed an enhancement request.

Meanwhile you can use this workaround to achieve your requirements:

  1. Define a STATIC-ID on your layout containing the tabs (e.g. Center Pane)
    example: PR10_CENTER

  2. Define a STATIC-ID on the region(s) which are shown as Tabs inside the Layout
    example: PR10_COUNTRY

  3. Create a hidden item that will trigger the disable / enable

  4. Define the following Javascript function in the "Function and Global Variable Declaration" of your page
    function disableTab(id, disable) { var p = Ext.getCmp('STATIC-ID of your Layout (e.g. PR10_CENTER)'), allTabs = p.items; allTabs.each(function(tab) { if(tab.getId() == id) { tab.setDisabled(disable); return false; } }); }

  5. Create a Dynamic Action listening to the "On Change" event of the hidden item created in step 3 having a condition based on the hidden items value

  6. Add a true action that runs following javascript code
    disableTab('STATIC-ID of the region where it's tab should be disabled (e.g. PR10_COUNTRY)',true);

  7. Add a false action if the tab should be activated again under specific circumstances


answered 31 Jul, 12:47

FOEX-SUPPORT's gravatar image

accept rate: 32%

Thanks for the quick response..I will work on trying this.

(31 Jul, 14:26) walkerdog walkerdog's gravatar image

I think I have something setup wrong. I've built a similar issue in tryfoexnow.com APP# 260. Could you take a peek at that one and let me know what I'm doing wrong? Thanks

(02 Aug, 16:44) walkerdog walkerdog's gravatar image

Thank you for your test case, now we understand your needs.

  1. You want to trigger the tab deactivation based on an action inside the child page, so you have to take care about the context.
    Your tab content is loaded inside an iframe and your hidden item resides on the parent page
  2. You referenced the wrong STATIC-ID as the parent (P1_MAIN_PAGE)

We updated your test case with a working configuration:
Button on Page 2 disables Tab of Page 2
Button on Page 3 disables Tab of Page 3

Define the correct parent region in the function:
alt text

Set the STATIC-ID on the parent region:
alt text

Set the STATIC-ID on the child Region(s):
alt text

Replaced your PL/SQL Action on the button to FOEX-Util - FOEX Actions - Set Items:
alt text

Call the disable Javascript function defined in the Header:
alt text


answered 03 Aug, 06:17

FOEX-SUPPORT's gravatar image

accept rate: 32%

edited 03 Aug, 06:20

Is there a way to disable all the tabs except the one you're on, without knowing the static_id?

(03 Aug, 10:12) walkerdog walkerdog's gravatar image

To disable all Tabs, remove the if statement inside each loop:

function disableAllTabs(pid, disable) { var p = Ext.getCmp(pid), allTabs = p.items; allTabs.each(function(tab) { tab.setDisabled(disable); } ); return false; }

The parameter pid needs the STATIC-ID of the Layout. We extended your test case with an additional button on page 2 to disable all tabs at once.


answered 03 Aug, 12:08

FOEX-SUPPORT's gravatar image

accept rate: 32%

I get this error, on page load, when I added the extra function:

Uncaught TypeError: Cannot read property 'items' of undefined

It is referring the disableAllTabs function.

We have not upgraded to FOEX 3.0 yet. Other then that, I have it almost exactly like it was built in the sample.

It works fine with just one function, just not both. Unfortunately, I need both so I can keep the main tab active.

(03 Aug, 14:12) walkerdog walkerdog's gravatar image
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: 28 Jul, 12:11

Seen: 247 times

Last updated: 04 Aug, 09:33

FOEX Links

Related questions