Discussions
Categories
- 196.7K All Categories
- 2.2K Data
- 235 Big Data Appliance
- 1.9K Data Science
- 449.8K Databases
- 221.5K General Database Discussions
- 3.8K Java and JavaScript in the Database
- 31 Multilingual Engine
- 549 MySQL Community Space
- 477 NoSQL Database
- 7.9K Oracle Database Express Edition (XE)
- 3K ORDS, SODA & JSON in the Database
- 532 SQLcl
- 4K SQL Developer Data Modeler
- 186.8K SQL & PL/SQL
- 21.2K SQL Developer
- 295.4K Development
- 17 Developer Projects
- 138 Programming Languages
- 292K Development Tools
- 104 DevOps
- 3.1K QA/Testing
- 645.9K Java
- 27 Java Learning Subscription
- 37K Database Connectivity
- 153 Java Community Process
- 105 Java 25
- 22.1K Java APIs
- 138.1K Java Development Tools
- 165.3K Java EE (Java Enterprise Edition)
- 17 Java Essentials
- 158 Java 8 Questions
- 85.9K Java Programming
- 79 Java Puzzle Ball
- 65.1K New To Java
- 1.7K Training / Learning / Certification
- 13.8K Java HotSpot Virtual Machine
- 94.2K Java SE
- 13.8K Java Security
- 203 Java User Groups
- 24 JavaScript - Nashorn
- Programs
- 390 LiveLabs
- 37 Workshops
- 10.2K Software
- 6.7K Berkeley DB Family
- 3.5K JHeadstart
- 5.6K Other Languages
- 2.3K Chinese
- 170 Deutsche Oracle Community
- 1K Español
- 1.9K Japanese
- 230 Portuguese
Disable CommandToolbarButton programmatically

Hi ,
I'm using JDeveloper 11.1.1.7.0
I have defined a button like this:
<af:commandToolbarButton id="launchButton"
text="#{uiBundle.LAUNCH}"
actionListener="#{LaunchPlanBean.planDialogSetUp}"
accessKey="L"
binding="#{KanbanPlanBean.planReadOnly}">
<af:showPopupBehavior popupId="launchPopup"
triggerType="click"/>
</af:commandToolbarButton>
In some conditions, I need to disable the button programmatically. I've tried this:
RichCommandToolbarButton readOnly;
....
....
readOnly.setdisable(true);
My issue is that, when running the page, it seems to work and button shows disabled with my right conditions.
But, if I click on the disabled button, popup appears. I have tried this with RichCommandButton and it is working fine but not with RichCommandToolbarButton.
How can I solve this?
Thanks & Regards
Best Answer
-
Timo Hahn Senior Principal Technical Consultant - Oracle ACE Director Member, Moderator Posts: 38,252 Red Diamond
Try using tiggerType="action" on hte af:showpopupbehavior.
Timo
Answers
-
Timo Hahn Senior Principal Technical Consultant - Oracle ACE Director Member, Moderator Posts: 38,252 Red Diamond
Can you do a test, please?
Set the disabled property of the button to false in the page. Now check what happens when you click on the button.
Tell us if the popup still opens in this case, please.
Timo
-
Hi Timo,
Thanks for response !
By default the disabled property of the button is false . In this case button is visible and pop-up is appearing after clicking of this button. Now I have set the disabled property of the button to True in the page and button shows disable in the page but still pop-up is coming up with click of this button.
-
Snippet code after change the disable property of this button:-
<af:commandToolbarButton id="launchButton"
text="#{uiBundle.LAUNCH}"
actionListener="#{LaunchPlanBean.planDialogSetUp}"
accessKey="L"
disabled="true">
<af:showPopupBehavior popupId="launchPopup"
triggerType="click"/>
</af:commandToolbarButton>
-
Timo Hahn Senior Principal Technical Consultant - Oracle ACE Director Member, Moderator Posts: 38,252 Red Diamond
Try using tiggerType="action" on hte af:showpopupbehavior.
Timo
-
Hi Timo ,
I have used your suggested solution and it is working for me .
Thank you for your assistance.
I am facing one more problem regarding the same problem but slightly different component.
I am trying to disable the commandImageLink by programmatically. Here is the code:
<af:commandImageLink
id="addPlanImage"
icon="/oracle/apps/flm/ekanban/common/images/addfile_ena.png"
actionListener="#{bindings.CreateInsert.execute}"
disabled="#{!bindings.CreateInsert.enabled}"
shortDesc="#{uiBundle.ADD_KANBAN_PLAN}"
binding="#{KanbanPlanBean.commandImageLinkReadOnly}" />
I have tried this for disabling the component programmatically:-
RichCommandImageLink commandImageLinkReadOnly;
...
...
...
commandImageLinkReadOnly.setDisabled(true);
My issue is that, when running the page, it seems to work and button shows disabled with my right conditions.
But, if I click on the disabled button, It is performing the action which is adding the row in the table. I have tried this on other commandImageLink and it is working fine but not working on this one. I am guessing that I have already bind disable property with other conditions so i am not able to disable it through binding property.
Please help me to solve this problem as well.
-
Timo Hahn Senior Principal Technical Consultant - Oracle ACE Director Member, Moderator Posts: 38,252 Red Diamond
Yes, that is my guess too.
You should not bind all components to a bean and work directly on them in the bean. The way to go is to use a bean property (or a method) for this and use this for the disabled property in the UI, like
<af:commandImageLink...disabled="#{mybean.linkdisabled}...
where mybean should be in request scope.
If you use a method to calculate the state, make sure the function is fast, as it'll be called multiple times.
The advantage of this approach is that the framework handles the refreshing stuff and that the other developers know that the property is handled specially.
Timo