This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



Mar 11, 2011, 7:13 PM
5 Posts

Dynamically Change Button Labels

  • Category: Server Side JavaScript
  • Platform: All
  • Release: 8.5.2
  • Role: Developer
  • Tags: Button,Label
  • Replies: 1
I would like to dynamically change a button label based on a selectedTabId property from a tab panel. (The old "Profiles" app).  For example, if the user selects Tab A, then I would like the button label to say "Create New A".    Tab B, "Create New B".  Can any one provide any suggestions?
 
Thanks!!  
Mar 11, 2011, 7:39 PM
41 Posts
Re: Dynamically Change Button Labels
Try the following (assuming that the component Id of your tabbed panel is "tabbedPanel1"). 
 
<xp:button value="Create New #{javascript:var tabbedPanel = getComponent('tabbedPanel1'); var selectedTab = tabbedPanel.findComponent(tabbedPanel.getSelectedTab()); return selectedTab.getLabel();}" />
 
So if you had tabs labeled "Contact", "Company", "Task", and "Message", your button's label would be "Create New Contact", "Create New Company", etc., based on which tab is selected.

This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal