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     Populating Listbox on checkbox_onclick event

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Populating Listbox on checkbox_onclick event
 Login/Join
 
Master
posted
Is there any way to keep the data from populating in the listbox unless a checkbox is checked?

We have a large list of customers we want to load into the listbox only if a checkbox is checked by the user. Otherwise, the page takes a long time to load.

Thanks!


Prod: Single Windows 2008 Server running Webfocus 7.7.03 Reporting server Web server IIS6/Tomcat, AS400 DB2 database.
 
Posts: 611 | Registered: January 04, 2007Report This Post
Platinum Member
posted Hide Post
Jason :
We have similar functionality in one of our HTML pages. By default, the page loads with an empty text-area box for the User to key in input. But if the User wants to be prompted with possible values, they have to click the "Get Values" button right next this empty box.

Clicking this button, executes a fex that pulls data, builds a multi-select box and re-executes the above HTML with a multi-select box.

You could code one program to do both of the above, with a branch around logic for each of the sections. By default is would show the empty box; and it will come back with a specific parm indicating it should pull data the next time around. This will be a fex with FOCUS code at the top and a -HTMLFORM at the bottom to build the appropriate HTML.

Hope that explanation helps.
Sandeep Mamidenna.


-------------------------------------------------------------------------------------------------
Blue Cross & Blue Shield of MS
WF.76-10 on (WS2003 + WebSphere) / EDA on z/OS + DB2 + MS-SQL
MRE, BID, Dev. Studio, Self-Service apps & a dash of fun !! Music
 
Posts: 218 | Location: Jackson, MS | Registered: October 31, 2006Report This Post
Virtuoso
posted Hide Post
As this will be my first post here, I'd better not make a fool of myself straight away.
There are a number of ways of doing this I believe. The recent thread on popup window can point in the right direction, or, my preferred option is to use a so called 'AJAX' method, using xmlhttp process. However, if you are a novice in javascript, this can be a bit daunting, but once you ahve the hang of it, it is an excellent way to proceed.
It is a method I use a lot, is fast and has the advantage of keeping the page, stuff already entered by the user, and other things in place. I have tested in the IE 6/7 Fx 1.5/2(win and mac), opera 9(win and mac), Safari and Camino(both mac) browsers.
As it will take me a little while to get an example together, let me know if this is of interest.


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Report This Post
Master
posted Hide Post
Thanks for the posts!

I have an idea of what bluezone is saying, but I'm not sure how to code it.

Does anyone know where can I find an example of what BlueZone proposed?

Thanks!


Prod: Single Windows 2008 Server running Webfocus 7.7.03 Reporting server Web server IIS6/Tomcat, AS400 DB2 database.
 
Posts: 611 | Registered: January 04, 2007Report This Post
Master
posted Hide Post
actually...

I'm an experienced asp and php programmer. I know how to do what I want in those languages using the postback.

The problem is that I don't know how to call a MRE .fex from an HTML Post and include variables. I did a search here on Focal Point, but didn't find anything of consequence.


Prod: Single Windows 2008 Server running Webfocus 7.7.03 Reporting server Web server IIS6/Tomcat, AS400 DB2 database.
 
Posts: 611 | Registered: January 04, 2007Report This Post
Platinum Member
posted Hide Post
Well so much for all that theory. Here is a practical sample using the CAR file for you Jason. I have split it into 2 FEXes for simplicity. It can be combined into one, by reading the &RUNTYP value.

To run these examples in your MRE, please insert your MRE domain & folder names as appropriate.

Goooooooood day !!
Sandeep Mamidenna
-*
-*
-*-*-* HERE STARTS THE FIRST FEX
-*-*-*
-*
-DEFAULTS &RUNTYP='A';
-SET &RUNTYP = 'B';
-*
-HTMLFORM BEGIN
<HTML><HEAD>
<script language='javascript'>
function runfexp(fex, parm) {
alert("1");
document.FRM1.IBIF_ex.value = fex ;
document.FRM1.IBIMR_fex.value = fex ;
document.FRM1.submit();
}
</script></head>
<body><form action="/ibi_apps/WFServlet" method="GET" name="FRM1">
<input type='hidden' name='IBIMR_domain' value='AAA/AAA.htm'>
<input type='hidden' name='IBIMR_folder' value='#BBB'>
<input type='hidden' name='IBIMR_action' value='MR_RUN_FEX'>
<input type='hidden' name='IBIMR_sub_action' value='MR_STD_REPORT'>
<input type='hidden' name='IBIMR_fex' value=''>
<input type='hidden' name='IBIF_ex' value=''>
<input type='hidden' name='RUNTYP' value='!IBI.AMP.RUNTYP;'>
<TABLE><TR>
<TD>Input Country-name :
<TEXTAREA NAME=GRPNUM ROWS=6 COLS=6></TEXTAREA>
<INPUT type="button" name="B1" value="Help with Values"
onClick="runfexp('app/car4.fex','B');">
</TD>
</TR></TABLE>
</FORM></BODY></HTML>
-HTMLFORM END
-*
-*
-*
-* HERE IS THE SECOND FEX (CALLED car4.fex IN MY MRE FOLDER)
-*
-*
-*
-* 2nd time around the value of &RUNTYP is 'B'
-*
TABLE FILE CAR
PRINT
DST.COUNTRY
ON TABLE HOLD AS H1
END
-*
DEFINE FILE H1
QT/A1='''';
END
TABLE FILE H1
PRINT
COMPUTE FLDX/A100 =
('document.write("' || '<option value=' | QT || COUNTRY ||
QT | '>' | COUNTRY | '</OPTION>");'
) ;
BY COUNTRY NOPRINT
ON TABLE HOLD AS HCNTRY
END
-RUN
-*
-LBL_SHOWHTML
-*
-HTMLFORM BEGIN
<HTML><HEAD>
<script language='javascript'>
function runfexp(fex, parm) {
document.FRM1.IBIF_ex.value = fex ;
document.FRM1.IBIMR_fex.value = fex ;
document.FRM1.submit();
}
</script></head>
<body><form action="/ibi_apps/WFServlet" method="GET" name="FRM1">
<input type='hidden' name='IBIMR_domain' value='AAA/AAA1.htm'>
<input type='hidden' name='IBIMR_folder' value='#BBB'>
<input type='hidden' name='IBIMR_action' value='MR_RUN_FEX'>
<input type='hidden' name='IBIMR_sub_action' value='MR_STD_REPORT'>
<input type='hidden' name='IBIMR_fex' value=''>
<input type='hidden' name='IBIF_ex' value=''>
<input type='hidden' name='RUNTYP' value='!IBI.AMP.RUNTYP;'>
<TABLE><TR>
<TD>
Pick Country :
<select name="CTRY" size="1">
!IBI.FIL.HCNTRY;
</SELECT>
</TD>
-LBL_SKPB
</TR></TABLE>
</FORM></BODY></HTML>
-HTMLFORM END


-------------------------------------------------------------------------------------------------
Blue Cross & Blue Shield of MS
WF.76-10 on (WS2003 + WebSphere) / EDA on z/OS + DB2 + MS-SQL
MRE, BID, Dev. Studio, Self-Service apps & a dash of fun !! Music
 
Posts: 218 | Location: Jackson, MS | Registered: October 31, 2006Report This Post
Expert
posted Hide Post
Jason,

There are two possible methods of doing this easily without having to write too much of your own JavaScript.

Method 1)

Set your listbox to have a "sourcetype" of "typeFex" and "datasource" of a fex that you want to populate it normally. Also have a hidden INPUT control with the "name" attribute set to "Country" and a "value" attribute set to something like "XXXX".
In the fex have the default for the where clause to something that does not exist. For instance, say I wanted to populate a listbox with all the values for COUNTRY from CAR. My fex for populating the control would be something like -
-DEFAULT &Country = 'XXXX'
TABLE FILE CAR
SUM FST.COUNTRY
BY COUNTRY
WHERE COUNTRY EQ '&Country.EVAL'
ON TABLE PCHOLD FORMAT XML
END

You'll understand that when the fex is executed as is, no data will be returned and therefore an empty control will be seen on loading.
Have an "onclick" event attached to your checkbox or radio button and within the javascript set the value of the "Country" control to "FOC_NONE" and then make a call to a function within the IBIRLS.js (or IBIRLS2.js) - populateDynamicCtrl("ctrl") - where "ctrl" is an object for the listbox control.

This should give you what you want. However, depending upon your source data, it could suffer performance wise.

Method 2)

Similar sort of thing as previous method, but assign the "datasource" attribute of your listbox during the onclick event. You could prevent javascript errors by assigning a dummy fex that accesses a small table and returns nodata.

Get your head around this type of thinking and you'll probably think of other alternatives.

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Master
posted Hide Post
Thanks Tony!

I'm attempting method #2 that you mentioned.
I set the default datasource to a 1 record table and keep the listbox(edit12) hidden, the the checkbox onclick sets it visible and reassigns the datasource.

Unfortunately I'm getting "errors on this page" at runtime. Below is my code.

function checkbox1_0_onclick(ctrl) {
if( checkbox1_0.checked == true )
edit12.style.visibility='visible';
edit12.data.datasource='acpbankl.mas';
else
edit12.style.visibility='hidden';

}



Thank you for your help!


Prod: Single Windows 2008 Server running Webfocus 7.7.03 Reporting server Web server IIS6/Tomcat, AS400 DB2 database.
 
Posts: 611 | Registered: January 04, 2007Report This Post
Expert
posted Hide Post
Jason,

To correct the syntax in your javascript, try -

function checkbox1_0_onclick(ctrl) {
  if(checkbox1_0.checked == true) {
     edit12.style.visibility='visible';
     edit12.data.datasource='acpbankl.mas';
  } else {
     edit12.style.visibility='hidden';
  }
}


T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report 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     Populating Listbox on checkbox_onclick event

Copyright © 1996-2020 Information Builders