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] Drop down list box On Change event

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Drop down list box On Change event
 Login/Join
 
Platinum Member
posted
Hi,
I have a requirement that I developed the front end page on HTML Composer, it has a combo box that has values MONTH, YTD,R12, when Month selected 2 Calendars will be displayed to select start and end dates but when R12 selected these Calendars should be hide mode, I achieved this functionality using on change event as bellow, but my issue is when I go back to MONTH, Calendars are not appearing back, can some one tell me where I`m doing wrong

  
//Begin function combobox1_onchange
function combobox1_onchange(ctrl) {

	var combobox1 = document.getElementById("combobox1"); 
	var dropdown_value = combobox1_onchange.value; 

	var calendar1 = document.getElementById("calendar1"); 
	var calendar2 = document.getElementById("calendar2"); 

	IbComposer_showHtmlElement("text1", false);
	IbComposer_showHtmlElement("text8", false);
	IbComposer_showHtmlElement("calendar1", false);
	IbComposer_showHtmlElement("calendar2", false);

	if(dropdown_value == "MON"){
		//showing the appropriate elements
		IbComposer_showHtmlElement("text1", true);
		IbComposer_showHtmlElement("text2", true);
      IbComposer_showHtmlElement("calendar1", true);
      IbComposer_showHtmlElement("calendar2", true);
	}else if (dropdown_value == "R12"){
		//showing the appropriate elements
		IbComposer_showHtmlElement("text1", false);
		IbComposer_showHtmlElement("text2", false);
      IbComposer_showHtmlElement("calendar1", false);
      IbComposer_showHtmlElement("calendar2", false);
	}else if (dropdown_value == "YTD"){
		//showing the appropriate elements
		IbComposer_showHtmlElement("text1", false);
		IbComposer_showHtmlElement("text2", false);
      IbComposer_showHtmlElement("calendar1", false);
      IbComposer_showHtmlElement("calendar2", false);
	}
}
//End function combobox1_onchange

This message has been edited. Last edited by: FP Mod Chuck,


WebFocus-8/Windows/HTML, PDF, EXCEL
 
Posts: 106 | Registered: September 20, 2010Report This Post
Master
posted Hide Post
Don't you need the if statement to look for "MONTH" not "MON"?

Also, the variable dropdown_value should equal combobox1.value;

Try the code below:
  
//Begin function combobox1_onchange
function combobox1_onchange(ctrl) {
    var combobox1 = document.getElementById("combobox1");
    //var dropdown_value = combobox1_onchange.value;
    var dropdown_value = combobox1.value;

    var calendar1 = document.getElementById("calendar1");
    var calendar2 = document.getElementById("calendar2");

    IbComposer_showHtmlElement("text1", false);
    IbComposer_showHtmlElement("text8", false);
    IbComposer_showHtmlElement("calendar1", false);
    IbComposer_showHtmlElement("calendar2", false);

    //if (dropdown_value == "MON") {
    if (dropdown_value == "MONTH") {
        //showing the appropriate elements
        IbComposer_showHtmlElement("text1", true);
        IbComposer_showHtmlElement("text2", true);
        IbComposer_showHtmlElement("calendar1", true);
        IbComposer_showHtmlElement("calendar2", true);
    } else if (dropdown_value == "R12") {
        //showing the appropriate elements
        IbComposer_showHtmlElement("text1", false);
        IbComposer_showHtmlElement("text2", false);
        IbComposer_showHtmlElement("calendar1", false);
        IbComposer_showHtmlElement("calendar2", false);
    } else if (dropdown_value == "YTD") {
        //showing the appropriate elements
        IbComposer_showHtmlElement("text1", false);
        IbComposer_showHtmlElement("text2", false);
        IbComposer_showHtmlElement("calendar1", false);
        IbComposer_showHtmlElement("calendar2", false);
    }
}
//End function combobox1_onchange

This message has been edited. Last edited by: Hallway,


Hallway

 
Prod: 8202M1
Test: 8202M4
Repository:
 
OS:
 
Outputs:
 
 
 
 
 
Posts: 608 | Location: Salt Lake City, UT, USA | Registered: November 18, 2015Report This Post
Virtuoso
posted Hide Post
Or simplified since you already hide the controls/elements that you don't want to be displayed by default you only need to test the condition to show them.
And as Hallway pointed out, you need to test the proper value.

//Begin function combobox1_onchange
function combobox1_onchange(ctrl) {
//showing the appropriate elements
    IbComposer_showHtmlElement("text1", false);
    IbComposer_showHtmlElement("text8", false);
    IbComposer_showHtmlElement("calendar1", false);
    IbComposer_showHtmlElement("calendar2", false);

    if (combobox1.value == "MONTH") {
        IbComposer_showHtmlElement("text1", true);
        IbComposer_showHtmlElement("text2", true);
        IbComposer_showHtmlElement("calendar1", true);
        IbComposer_showHtmlElement("calendar2", true);
    }
}
//End function combobox1_onchange

This message has been edited. Last edited by: MartinY,


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
Virtuoso
posted Hide Post
Even shorter:
function combobox1_onchange(ctrl) {
    // I think the assignment of combobox1 got lost in Martin's example, but ctrl should be a usable reference for the same.
    var show = (ctrl.value == "MONTH");

    IbComposer_showHtmlElement("text1", show);
    IbComposer_showHtmlElement("text8", show);
    IbComposer_showHtmlElement("calendar1", show);
    IbComposer_showHtmlElement("calendar2", show);
}


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
 
Posts: 1669 | Location: Enschede, Netherlands | Registered: August 12, 2010Report This Post
Platinum Member
posted Hide Post
Thank you Hallway,

it worked halfway when I changed to combobox1.value, calendar box is hiding but not calendar icon, icon is still visible when I select R12 or YTD, is their any way I can hide the calendar icon also.

Thanks,
Krishna


WebFocus-8/Windows/HTML, PDF, EXCEL
 
Posts: 106 | Registered: September 20, 2010Report This Post
Virtuoso
posted Hide Post
Something that I had to used to show/hide the calendar image, but can't remember with which version of WF (probably an early version of WF8) and doesn't seems to be anymore an issue with at least v8201M

// This function is to hide the calendar icon which is not hidden when hiding the calendar control
function hideCalendarIcon() {
	//get all images on the page into array
	images=document.getElementsByTagName("img");
	//get the number of images in array
	numImages = images.length;
	
	//Loop through images and see if it is a dynCalendar
	for (i=0;i<numImages;++i) {
  		if (images[i].src.indexOf("dynCalendar.gif")>0){
		//If it is, hide
   			images[i].style.visibility='hidden';
		}
	}
}

// This function is to show the calendar icon
function showCalendarIcon() {
	//get all images on the page into array
	images=document.getElementsByTagName("img");
	//get the number of images in array
	numImages = images.length;
	
	//Loop through images and see if it is a dynCalendar
	for (i=0;i<numImages;++i) {
  		if (images[i].src.indexOf("dynCalendar.gif")>0){
		//If it is, show
   			images[i].style.visibility='visible';
		}
	}
}


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
Virtuoso
posted Hide Post
Wep Good One


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] Drop down list box On Change event

Copyright © 1996-2020 Information Builders