Main Region

Change Button label dynamically
2 answers | 3597 views

RE
Sep 22, 2015 19:46 +00:00

Hello Matt,

I have a FOEX Button on my home page with a dynamic label. My requirement is something like in the sample test case, the label of P1_TEST button is derived from the P1_HID_ITEM. The hidden item value may change based on some process on my page. At that time, i also want to refresh or change my button label dynamically.

http://demo.tryfoexnow.com/apex/f?p=700:1:

I tried FOEX Actions [Plug-in]-Set Title and selected the button in the below affected elements, but i am not able to achieve the expected result. Please suggest or let me know if there is a way to refresh the button label dynamically.

Thank you.

7 comments

RE
Rebecca Sep 23, 2015 07:44 +00:00 

Thank you Matt. I used this to make it work.

Ext.getCmp('P1_TEST').setText($v('P1_HID_ITEM'));

CH
Christian86 Nov 4, 2015 12:43 +00:00 

do you use this with an dynamic action which executes an java script?

MN
Matt Nolan Nov 4, 2015 12:52 +00:00 

Yes you can use this within an "Execute Javascript Code" dynamic action.

CH
Christian86 Nov 4, 2015 13:06 +00:00 

I get following error: TypeError: Ext.getCmp(...) is undefined

MN
Matt Nolan Nov 4, 2015 14:11 +00:00 

Please create a test case.

CH
Christian86 Nov 4, 2015 14:50 +00:00 

FX_WS_1405, Application 139, Page 1, Dynamic action on P1_BUTTON1

CH
Christian86 Nov 4, 2015 15:16 +00:00 

I am sorry, thank you

MN
Sep 23, 2015 06:32 +00:00

We currently do not have a dynamic action to support this requirement. I have logged an enhancement request to create a new "FOEX Button Actions" dynamic action to allow you to change the text, icon, and action when clicked.

In the interim you may want to look at the Ext JS API and use some custom javascript to achieve your requirement: http://docs.sencha.com/extjs/4.2.3/#!/api/Ext.button.Button-method-setText

0 comments

MN
Nov 4, 2015 14:59 +00:00

@Christian Kainz

When using Ext.getCmp please make sure you use a valid item / region ID. Buttons you need to define a static ID and not rely on the button name i.e.

alt text

0 comments

You must log in or sign up to post questions and answers.