I have a HTML page . I have 3 listboxes in the page. The fields are named as REGION, STATE and CITY. When I click the Region list box , it should populate only states within the Region (For ex SouthEast region has states like NC, Sc and GA). Similarly when click the STate List Box, only cities within the state need to be displayed in the City List box. I tried using the Chain feature but that does'nt work well. Is there a different way I can do this. Any help will be appreciated
rs
January 23, 2007, 05:34 PM
BlueZone
We have similar functionality in an application. Here is how you could do it.
1> Show HTML with only the REGION dropdown and no selectable input for STATE & CITY. The REGION field is a SELECT box with an 'onChange' event to run a 2nd pgm. <select name="REG" size="1" onChange='runit()'> <option value="NADA">Select From the Following.....</option> !IBI.FIL.HREGIONS; </SELECT>
2> The second fex will get the STATE values for the input REGION and quickly build another SELECT drop-down with its own onChange event to run a 3rd pgm. The page at this point shows drop-downs for REG & ST. <select name="REG" size="1" onChange='runit()'> <option value="!IBI.AMP.REG;" SELECTED> </option> !IBI.FIL.HREGIONS; </SELECT> ...... <select name="ST" size="1" onChange='runit2()'> <option value="NADA">Select From the Following.....</option> !IBI.FIL.HSTATES; </SELECT>
3> When a State is selected, the 3rd pgm quickly builds the Cities dropdown based on the State selection value and builds a new Page with all 3 selectable fields on it. While jumping page to page, you need to make sure that the REG or ST values display what ever was selected in the previous step.
It is pretty straight forward and with the small drop-down lists to build, the User will not really see much time-lag in this process.
Hope that 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 !!
January 24, 2007, 04:33 AM
Tony A
rs,
When you say that the chain feature "doesn't work well", in what way do you mean?
If it takes a long time to process the child dropdowns then that is due to each one being extracted on the fly, and, depending upon the amount of data being returned, this will always be the case.
Sandeep's method works on a similar principle as the chaining but he controls it using his own javascript so for larger lists the same sort of overheads will apply.
What ever method you employ you still need a chaining action so that selection in one affects another, so if we can understand your concern with the chaining we might be able to advise further.
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
January 24, 2007, 09:00 AM
rs
Thanks a lot Sandeep. I have done some reporting using WebFocus and SQL Server database. I apologize for being a Novice in WebFocus/HTML. In regards to your reply where you mentioned
can you please be more specific on that. If possible can you send me a copy of the javascript, HTML and .fex procedure to the following address "rsankar@bbandt.com". I can use that as a reference and make changes accordingly. Your help is appreciated
Thanks rs
rs
January 24, 2007, 12:07 PM
BlueZone
Sure thing. Will try to work up an example real quick using the CAR file and post it to you in a little while.
Goooooooooooood day !! 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 !!
January 25, 2007, 10:06 AM
BlueZone
Apologize for the delay on this rs, had been a busy day yesterday.
Anyways, I have worked up the following 2 pieces of code for you using the CAR file to display chain functoinality. Copy them into your MRE as two fexes and see how they work. It will give you an idea to extend it to a 3rd event. Be sure to change the MR_DOMAIN, MR_FOLDER & fex names to suit your environment. The concept is to use FOCUS to write out HTML SELECT box syntax to a hold file, and then insert that file into a HTML place holder. -* -* -* program #1 (xcar1.fex) -* -* 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 -* -HTMLFORM BEGIN <HTML><HEAD> <script language='javascript'> function runit() { var opt=document.FRM1.CTRY.options(document.FRM1.CTRY.selectedIndex).value; if (opt != 'NADA'){ document.FRM1.IBIF_ex.value = 'app/xcar2.fex' ; document.FRM1.IBIMR_fex.value = 'app/xcar2.fex' ; document.FRM1.submit(); } } </script></head> <body><form action="/ibi_apps/WFServlet" method="GET" name="FRM1"> <input type='hidden' name='IBIMR_domain' value='aaaaaaa/aaaaaa.htm'> <input type='hidden' name='IBIMR_folder' value='#bbbbbbbbbb'> <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=''> <TABLE><TR><TD WIDTH=30%>Country= <select name="CTRY" size="1" onChange='runit()'> <option value="NADA">Select From the Following.....</option> !IBI.FIL.HCNTRY; </SELECT></TD><TD WIDTH=30%> Car=</TD> <TD WIDTH=30%> Seats=</TD></TR></TABLE> </FORM></BODY></HTML> -HTMLFORM END -* -* -* -*-*-*-* program #2 (xcar2.fex) -*-*-*-*-*-*-*-*-* -* -* -* -SET &ECHO=ALL; -SET &CTRYX=&CTRY; 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 -* -* TABLE FILE CAR PRINT DST.CAR WHERE COUNTRY EQ '&CTRY' ON TABLE HOLD AS H3 END -* DEFINE FILE H3 QT/A1=''''; END TABLE FILE H3 PRINT COMPUTE FLDX/A100 = ('document.write("' || '<option value=' | QT || CAR || QT | '>' | CAR | '</OPTION>");' ) ; BY CAR NOPRINT ON TABLE HOLD AS HCAR END -RUN -*-EXIT -* -HTMLFORM BEGIN <HTML><HEAD> <script language='javascript'> function runit() { var opt=document.FRM1.CTRY.options(document.FRM1.CTRY.selectedIndex).value; if (opt != 'NADA'){ document.FRM1.IBIF_ex.value = 'app/xcar2.fex' ; document.FRM1.IBIMR_fex.value = 'app/xcar2.fex' ; document.FRM1.submit(); } } function runit2() { var opt=document.FRM1.CAR.options(document.FRM1.CAR.selectedIndex).value; if (opt != 'NADA'){ document.FRM1.IBIF_ex.value = 'app/xcar3.fex' ; document.FRM1.IBIMR_fex.value = 'app/xcar3.fex' ; document.FRM1.submit(); } }
Hope that helps, Sandeep Mamidenna.This message has been edited. Last edited by: BlueZone,
------------------------------------------------------------------------------------------------- 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 !!
January 25, 2007, 10:52 AM
TexasStingray
rs, If you are saying it does not work well are you referring to performance. There are a couple of things that you can do to increase performance.
1. probabily the best, if you are using dynamic dropdowns then besure you are using summary table (1 for Region, 1 for Region and State, and 1 for Region State and City).
2. Try using a procedure to populate the dowpdowns and not the table directly. This gives you better control over the SQL being generated and shipped to the RDBMS. You can turn on tracing to see the SQL being generated. you can be sure to used DST.xxxxx and you could even use SQL Passthru.