Focal Point Banner
Community Center Education Summit Technical Support User Groups
Let's Get Social!

Facebook Twitter LinkedIn YouTube
Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] multiselect help
Go
New
Search
Notify
Tools
Reply
  
[SOLVED] multiselect help
 Login/Join
 
Gold member
posted
Ok guys, I need some help with my multiselect box. i have attached the javascript that will populate my S2 listbox. When i setup an alert the values in the S2 listbox are showing up. I assumed webfocus would pass &S2=A OR B...ETC, etc. When i click on submit the variable &S2 is not getting passed. i guess i know you can populate javascript with a !IBI.FIL or !IBI.AMP but shouldn't &S2 pass without a hidden variable? I do not use Developer Studio so I would not be able to throw in report painter.

Any advice would be great!! thanks for your help in advance.

  
<SCRIPT LANGUAGE="JavaScript">
function moveOver()  
{
var boxLength = document.myChoices.S2.length;
var selectedItem = document.myChoices.S1.selectedIndex;
var selectedText = document.myChoices.S1.options[selectedItem].text;
var selectedValue = document.myChoices.S1.options[selectedItem].value;
var i;
var isNew = true;
if (boxLength != 0) {
for (i = 0; i < boxLength; i++) {
thisitem = document.myChoices.S2.options[i].text;
if (thisitem == selectedText) {
isNew = false;
break;
      }
   }
var strValues = "";
//var boxLength = document.myChoices.S2.length;
var count = 0;
if (boxLength != 0) {
for (i = 0; i < boxLength; i++) {
if (count == 0) {
strValues = document.myChoices.S2.options[i].value;
}
else {
strValues = strValues + "," + document.myChoices.S2.options[i].value;
}
count++;
   }
}
//{
//alert("Here are the values you've selected:\r\n" + strValues);
//}
}
if (isNew) {
newoption = new Option(selectedText, selectedValue, false, false);
document.myChoices.S2.options[boxLength] = newoption;
}
document.myChoices.S1.selectedIndex=-1;
}

function removeMe() {
var boxLength = document.myChoices.S2.length;
arrSelected = new Array();
var count = 0;
for (i = 0; i < boxLength; i++) {
if (document.myChoices.S2.options[i].selected) {
arrSelected[count] = document.myChoices.S2.options[i].value;
}
count++;
}
var x;
for (i = 0; i < boxLength; i++) {
for (x = 0; x < arrSelected.length; x++) {
if (document.myChoices.S2.options[i].value == arrSelected[x]) {
document.myChoices.S2.options[i] = null;
   }
}
boxLength = document.myChoices.S2.length;
   }
}

</script>

<BODY  LINK="#0000FF" ALINK="#0000FF" VLINK="#0000FF"
  ONLOAD="DefPick()" BGCOLOR="#0FFFF">
       

<FORM name=myChoices method='POST' target='rptWin'                           
         onSubmit="return validate(myChoices)";                                
            action='/ibi_apps/WFServlet'>
<TABLE width="95%" height="10%" border=0>
<tr>
<td colspan="1">
<FONT COLOR="BLACK" SIZE=2>[b]Available Sorts[/b]</FONT>
<br>
<select name="S1" id="S1" style="WIDTH: 220px" size=13 onchange="moveOver();">
 <option value='N'>No Sort
<option value='A'>Reserve Responsibility Group
<option value='B'>Intermediate Summary Group
<option value='C'>Corp Code
<option value='D'>Business Unit
<option value='E'>Market
<option value='F'>Carrier
<option value='G'>Country Code
</select>
</td>

<td colspan="2">
<FONT COLOR="BLACK" SIZE=2>[b]SortBy:[/b]</FONT>
<br>
<select multiple name="S2" id="S2" style="width:220;" size="4">
</select>
</td>

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


WF 7.6.10 /IIS 6/ JBoss Enterprise 4.3
Windows XP SP 2/Windows 2003 Server
MVS 7.3.3
 
Posts: 76 | Location: Hartford, CT | Registered: August 30, 2005Reply With QuoteReport This Post
Expert
posted Hide Post
1) Hartford, simple answer is Use Dev Stu. no reason not to.
2) the old way of passing hand-written multi selects from the old devstu gave you NOT &S2
but rather &S20 = the number of elements picked
&S21 the first value
&S22 the second value
&S23 etc
etc...up to the number you've picked, i.e. the value in &S20.
Then it was up to you to loop in your fex: something sorta like this:
-SET &KOUNTER = 1 ;
WHERE thing EQ &S21
-REPEAT end.loop &S20 - 1 TIMES
-SET &KOUNTER = &KOUNTER + 1 ;
OR &S2|&KOUNTER
-end.loop
3) the new devstu way passes the single parm string with the ORs stuck in.
&S2='RICKY OR LUCY OR DESI OR ETHEL'
so
WHERE thing EQ &S2
is all you need.

do a -? & as the first line of your fex to see what your page is actually passing.

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




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Reply With QuoteReport This Post
Virtuoso
posted Hide Post
You have to select all the items in S2 for them to be passed.


"There is no limit to what you can achieve ... if you don’t care who gets the credit." Roger Abbott
 
Posts: 1102 | Location: Toronto, Ontario | Registered: May 26, 2004Reply With QuoteReport This Post
Gold member
posted Hide Post
i did a -? &S2 and no variable was getting passed.

this is where i was hoping someone would say you forgot x


WF 7.6.10 /IIS 6/ JBoss Enterprise 4.3
Windows XP SP 2/Windows 2003 Server
MVS 7.3.3
 
Posts: 76 | Location: Hartford, CT | Registered: August 30, 2005Reply With QuoteReport This Post
Expert
posted Hide Post
Hartford, you don't do a
-? &S2
you do a
-? &
the variable &S2 isn't getting passed...if your multiselect is a handwritten, old non devstu7 kind.
If so, you'll see
&S20
&S21
etc.
See???




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Reply With QuoteReport This Post
Gold member
posted Hide Post
my listboxes that are used in the multiselect do not show any value getting passed when i perform a -? &


WF 7.6.10 /IIS 6/ JBoss Enterprise 4.3
Windows XP SP 2/Windows 2003 Server
MVS 7.3.3
 
Posts: 76 | Location: Hartford, CT | Registered: August 30, 2005Reply With QuoteReport This Post
Expert
posted Hide Post
then your probs are deeper than multiselect...
devstu is the way to go. imho.




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Reply With QuoteReport This Post
Gold member
posted Hide Post
i set a value in the javascript:
document.myChoices.srt2.value = strValues;

then i passed it as a hidden variable and it works.


WF 7.6.10 /IIS 6/ JBoss Enterprise 4.3
Windows XP SP 2/Windows 2003 Server
MVS 7.3.3
 
Posts: 76 | Location: Hartford, CT | Registered: August 30, 2005Reply With QuoteReport This Post
Expert
posted Hide Post
As dhagen stated, you need to select the values you moved via JavaScript:

<SCRIPT LANGUAGE="JavaScript">
function moveOver()
{
var boxLength = document.myChoices.S2.length;
var selectedItem = document.myChoices.S1.selectedIndex;
var selectedText = document.myChoices.S1.options[selectedItem].text;
var selectedValue = document.myChoices.S1.options[selectedItem].value;
var i;
var isNew = true;
if (boxLength != 0) {
for (i = 0; i < boxLength; i++) {
thisitem = document.myChoices.S2.options[i].text;
if (thisitem == selectedText) {
isNew = false;
break;
      }
   }
var strValues = "";
//var boxLength = document.myChoices.S2.length;
var count = 0;
if (boxLength != 0) {
for (i = 0; i < boxLength; i++) {
if (count == 0) {
strValues = document.myChoices.S2.options[i].value;
}
else {
strValues = strValues + "," + document.myChoices.S2.options[i].value;
}
count++;
   }
}
//{
//alert("Here are the values you've selected:\r\n" + strValues);
//}
}
if (isNew) {
newoption = new Option(selectedText, selectedValue, false, false);
document.myChoices.S2.options[boxLength] = newoption;
}
document.myChoices.S1.selectedIndex=-1;
}

function removeMe() {
var boxLength = document.myChoices.S2.length;
arrSelected = new Array();
var count = 0;
for (i = 0; i < boxLength; i++) {
if (document.myChoices.S2.options[i].selected) {
arrSelected[count] = document.myChoices.S2.options[i].value;
}
count++;
}
var x;
for (i = 0; i < boxLength; i++) {
for (x = 0; x < arrSelected.length; x++) {
if (document.myChoices.S2.options[i].value == arrSelected[x]) {
document.myChoices.S2.options[i] = null;
   }
}
boxLength = document.myChoices.S2.length;
   }
}

function SelectAll(selObj)
{
selectObject = eval('document.forms[0].' + selObj);
for(i=0; i<selectObject.length; i++) selectObject.options[i].selected = true;
}
</script>

<BODY  LINK="#0000FF" ALINK="#0000FF" VLINK="#0000FF"
  ONLOAD="/* DefPick() */" BGCOLOR="#0FFFF">


<FORM name=myChoices method='POST' target='rptWin'
         onSubmit="/* return validate(myChoices) */; SelectAll('S2');";
            action='/ibi_apps/WFServlet'>
<input type="hidden" name="IBIF_ex" value="fmfp100">
<TABLE width="95%" height="10%" border=0>
<tr>
<td colspan="1">
<FONT COLOR="BLACK" SIZE=2>[b]Available Sorts[/b]</FONT>
<br>
<select name="S1" id="S1" style="WIDTH: 220px" size=13 onchange="moveOver();">
 <option value='N'>No Sort
<option value='A'>Reserve Responsibility Group
<option value='B'>Intermediate Summary Group
<option value='C'>Corp Code
<option value='D'>Business Unit
<option value='E'>Market
<option value='F'>Carrier
<option value='G'>Country Code
</select>
</td>

<td colspan="2">
<FONT COLOR="BLACK" SIZE=2>[b]SortBy:[/b]</FONT>
<br>
<select multiple name="S2" id="S2" style="width:220;" size="4">
</select>
</td>

<input type="submit" value="Submit" onClick="">

</form>
</body>
</html>


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Reply With QuoteReport This Post
Gold member
posted Hide Post
thank you everyone for your help


WF 7.6.10 /IIS 6/ JBoss Enterprise 4.3
Windows XP SP 2/Windows 2003 Server
MVS 7.3.3
 
Posts: 76 | Location: Hartford, CT | Registered: August 30, 2005Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] multiselect help

Copyright © 1996-2018 Information Builders, leaders in enterprise business intelligence.