APP PREPENDPATH IBISAMP TABLE FILE CAR PRINT COMPUTE CTRY_CNT/P2 = IF COUNTRY EQ LAST COUNTRY THEN LAST CTRY_CNT ELSE CTRY_CNT + 1; NOPRINT COMPUTE CTRY_INP/A100 = '<input type="checkbox" id="CTRY'||EDIT(CTRY_CNT)||'" name="CTRY" value="' ||COUNTRY||'" onClick="check_click(''CTRY'||EDIT(CTRY_CNT)||''');">'; AS '' BY COUNTRY AS '' ON TABLE HOLD AS MYHTML FORMAT HTMTABLE ON TABLE SET HTMLCSS ON ON TABLE SET PAGE NOLEAD ON TABLE SET STYLE * GRID=OFF, SIZE=9, $ TYPE=DATA, COLUMN=COUNTRY, CLASS=ctry_style, $ TYPE=DATA, COLUMN=CTRY_INP, CLASS=chck_style, $ ENDSTYLE END -RUN -HTMLFORM BEGIN <html> <head> <title>Multi Checkboxes</title> <style> .ctry_style {width:200px;} .chck_style {width:25px;} </style> <script language=javascript> function check_click(ctry) { // Perform anything you need within this function if (document.getElementById(ctry).checked) { // control is checked alert("You have selected "+document.getElementById(ctry).value); } else { // control is unchecked } // alert("You have selected "+document.getElementById(ctry).value); } function select_all() { SelAll = document.getElementById("SELALL"); Countries = document.getElementsByName("CTRY"); for (i=0;i<Countries.length;i++) { Country = Countries[i]; Country.checked = SelAll.checked; } } function submit_form() { // Here you can validate the form. Such as to ensure at least one country is clicked etc. Countries = document.getElementsByName("CTRY"); var ctry_cnt = 0; for (i=0;i<Countries.length;i++) { Country = Countries[i]; ctry_cnt += Country.checked; } if (ctry_cnt > 0) { document.form.target = "_blank"; generate_random(); document.form.submit(); } else { alert("You must select at least one Country"); } } function generate_random() { var Random_No = Math.floor(Math.random()*100000); Rand = document.getElementById("IBIMR_random"); Rand.value = Random_No; } </script> </head> <body> <form name="form" method="get" action="/ibi_apps/WFServlet"> <input type=hidden name="IBIF_ex" id="IBIF_ex" value="fexname.fex"> <input type=hidden name="IBIAPP_app" id="IBIAPP_app" value="appfolder"> <!-- MRE / BID Version variables <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_domain" value="xxxxxxxx/xxxxxxxx.htm"> <input type=hidden name="IBIMR_folder" value="#xxxxxxxxxxxx"> <input type=hidden name="IBIMR_fex" value="app/fexname.fex"> --> <!-- Common variables --> <!-- This turns off amper autoprompting --> <input type=hidden name="WF_DESCRIBE" id="WF_DESCRIBE" value="OFF"> <!-- this should avoid caching problems --> <input type=hidden name="IBIMR_random" id="IBIMR_random" value=0> !IBI.FIL.MYHTML; <table cellpadding=1 class='x1'> <tr> <td class='ctry_style' style="background-color:#ccccff;"> Select All</td> <td class='chck_style'> <input type="checkbox" id="SELALL" value="ALL" onClick="select_all();"></td> </tr> <tr> </table> <input id=btn_submit style="position:relative; top:10px; left:70px; width:38px; height:22px; background-color:#f0f5ff; background-image:url(/ibi_html/javaassist/ibi/html/describe/run16.gif);" type="button" value=" " onClick="submit_form();"> <input id=btn_reset style="position:relative; top:10px; left:80px; width:38px; height:22px; background-color:#f0f5ff; background-image:url(/ibi_html/javaassist/ibi/html/describe/reset.gif);" type="reset" value=" "> </form> </body> </html> -HTMLFORM END
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 |