Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Javascript to show or hide element based upon selected value in Listbox

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Javascript to show or hide element based upon selected value in Listbox
 Login/Join
 
Member
posted
Hi all,

I'd like to use a JavaScript function that I add to the 'Embedded JavaScript/CSS' section of App Studio.

I have multiple listboxes, all of which have an 'ALL' option. What I want to do is show or hide an element (radio1) depending on whether 'ALL' is selected in listbox3.

I've had a go, but haven't managed to get it to work:

function listbox3_onclick(event) {
var curValue = IbComposer_isSelected('listbox3',['ALL']);
IbComposer_showHtmlElement('radio1',curValue);
}

I believe that once I have the function working correctly, I need to assign a 'JavaScript call' to a 'Selection changed' trigger in 'Tasks and Animations' and assigning the 'Trigger Identifier' to be 'listbox3'?

Any advice would be greatly appreciated.

This message has been edited. Last edited by: FP Mod Chuck,
 
Posts: 11 | Location: United Kingdom | Registered: September 07, 2010Report This Post
Virtuoso
posted Hide Post
quote:

function listbox3_onclick(event)
{
var curValue = IbComposer_isSelected('listbox3',['ALL']);
IbComposer_showHtmlElement('radio1',curValue);
}

By the above, it should show radio1 when listbox3 has ALL selected.
So to show or hide I will try it that way

function window_onload() {
   UpdateData();
}
function onInitialUpdate()
{
      IbComposer_showHtmlElement('radio1', 0);
}
function listbox3_onclick(event) {
var eventObject = event ? event : window.event;
var ctrl = eventObject.target ? eventObject.target : eventObject.srcElement;
   var curValue = IbComposer_isSelected('listbox3',['ALL']);
 
   if (curValue == 0)
      IbComposer_showHtmlElement('radio1', 1);
   else
      IbComposer_showHtmlElement('radio1', 0);
}


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2409 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Report This Post
Member
posted Hide Post
Hi MartinY,

That has worked beautifully, thank you very much.

I needed to substitute ['ALL'] with ['_FOC_NULL'] and then, hey presto!

Thank again!
 
Posts: 11 | Location: United Kingdom | Registered: September 07, 2010Report This Post
Virtuoso
posted Hide Post
My pleasure

quote:
I needed to substitute ['ALL'] with ['_FOC_NULL']


True depending if you have used the default ALL option from the control or if you have inserted your own value. But yes you may have to change it as you did.

Edit your first post then add [SOLVED] at the beginning of the subject.


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2409 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Javascript to show or hide element based upon selected value in Listbox

Copyright © 1996-2020 Information Builders