Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

Passing the selections from a list box

5 posts in PowerSite specific Last posting was on 2001-07-26 17:10:23.0Z
Alan Rosine Posted on 2001-07-26 00:20:31.0Z
Newsgroups: sybase.public.powersite
From: "Alan Rosine" <alan.rosine@dfas.mil>
Subject: Passing the selections from a list box
Date: Wed, 25 Jul 2001 19:20:31 -0500
Lines: 25
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2462.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2462.0000
NNTP-Posting-Host: DNS21z.dfas.mil 207.133.68.234
Message-ID: <382_Frc7BwWFBHA.201@forums.sybase.com>
Path: forums-1-dub!forums-1-dub!forums-master.sybase.com!forums.sybase.com
Xref: forums-1-dub sybase.public.powersite:141
Article PK: 862570

I have a multi-select list box (call it listBox) on a form. When the user
selects one or more items in the list and clicks the submit button the items
are passed into the receiving script as an array. The problem is I can't
seem to access the length property to determine how many entries are in the
array. I've tried...

document.value.listBox.length
----
var myArray = document.value.listBox
var len = myArray.length
---
var myArray = new Array()
myArray = document.value.listBox
var len = myArray.length

Regardless of what I try I get an error trying to access the length property
and an len variable with an undefined value.

Any help would be appreciated.

TIA
Alan Rosine


Adam Simmonds [TeamSybase] Posted on 2001-07-26 12:09:03.0Z
Newsgroups: sybase.public.powersite
Date: Thu, 26 Jul 2001 22:09:03 +1000
From: "Adam Simmonds [TeamSybase]" <asimmond@mail.usyd.edu.au>
Reply-To: adam.simmonds@teamsybase.com
Organization: University Of Sydney
X-Mailer: Mozilla 4.76 [en] (WinNT; U)
X-Accept-Language: en
MIME-Version: 1.0
Subject: Re: Passing the selections from a list box
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 47
NNTP-Posting-Host: nat-41.mp.usyd.edu.au 129.78.4.41
Message-ID: <382_3B60085F.76310F41@mail.usyd.edu.au>
References: <382_Frc7BwWFBHA.201@forums.sybase.com>
Path: forums-1-dub!forums-1-dub!forums-master.sybase.com!forums.sybase.com
Xref: forums-1-dub sybase.public.powersite:140
Article PK: 840499

I achieved this a while back by accessing the dataForm as follows. The
column name is appended with a _0

numOptions = document.htmldw1_dataForm.international_typeid_0.length;

My full script is as follows ( it is called to grab the values from the
select box and add them to a computed column on the htmldw so the server
gets all the values )

function savechanges()
{

var options = '';
numOptions = document.htmldw1_dataForm.international_typeid_0.length;
for ( x=0; x<numOptions; x++ )
{
selected =
document.htmldw1_dataForm.international_typeid_0[x].selected
value = document.htmldw1_dataForm.international_typeid_0[x].value
options = options + value + "|" + selected + ","
}

htmldw1.SetItem( 1, "selectedvalues", options );

htmldw1.AcceptText()
htmldw1.Update()
htmldw1.restoreFocus()
}

HTH

A.

Alan Rosine wrote:
>
> I have a multi-select list box (call it listBox) on a form. When the user
> selects one or more items in the list and clicks the submit button the items
> are passed into the receiving script as an array. The problem is I can't
> seem to access the length property to determine how many entries are in the
> array. I've tried...
>
> document.value.listBox.length
> ----
> var myArray = document.value.listBox
> var len = myArray.length
> ---
> var myArray = new Array()
> myArray = document.value.listBox
> var len = myArray.length
>
> Regardless of what I try I get an error trying to access the length property
> and an len variable with an undefined value.
>
> Any help would be appreciated.
>
> TIA
> Alan Rosine

--
__________________________

Adam Simmonds [TeamSybase]
System Architect
ITS FLEXSIS PROJECT
The University of Sydney
Phone: +61 2 9351 5174
Mobile: +61 403 341 474
Fax: +61 2 9351 7711


Alan Rosine Posted on 2001-07-26 15:00:43.0Z
Newsgroups: sybase.public.powersite
From: "Alan Rosine" <alan.rosine@dfas.mil>
Subject: Re: Passing the selections from a list box
Date: Thu, 26 Jul 2001 10:00:43 -0500
Lines: 90
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2462.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2462.0000
NNTP-Posting-Host: DNS21z.dfas.mil 207.133.68.234
Message-ID: <382_XM2$6beFBHA.201@forums.sybase.com>
References: <382_Frc7BwWFBHA.201@forums.sybase.com> <382_3B60085F.76310F41@mail.usyd.edu.au>
Path: forums-1-dub!forums-1-dub!forums-master.sybase.com!forums.sybase.com
Xref: forums-1-dub sybase.public.powersite:139
Article PK: 862569

I don't have (or can't seem to find) anything that references the dataForm
of the document object. Your example suggests you are referencing a
datawindow on a form (htmldw1_dataForm). In your example, what does
htmldw1_dataForm reference?

My list box is inside a table within the form I am passing. How would I
reference this?

TIA
Alan Rosine

"Adam Simmonds [TeamSybase]" <asimmond@mail.usyd.edu.au> wrote in message
news:3B60085F.76310F41@mail.usyd.edu.au...
> I achieved this a while back by accessing the dataForm as follows. The
> column name is appended with a _0
>
> numOptions = document.htmldw1_dataForm.international_typeid_0.length;
>
> My full script is as follows ( it is called to grab the values from the
> select box and add them to a computed column on the htmldw so the server
> gets all the values )
>
> function savechanges()
> {
>
> var options = '';
> numOptions = document.htmldw1_dataForm.international_typeid_0.length;
> for ( x=0; x<numOptions; x++ )
> {
> selected =
> document.htmldw1_dataForm.international_typeid_0[x].selected
> value = document.htmldw1_dataForm.international_typeid_0[x].value
> options = options + value + "|" + selected + ","
> }
>
> htmldw1.SetItem( 1, "selectedvalues", options );
>
> htmldw1.AcceptText()
> htmldw1.Update()
> htmldw1.restoreFocus()
> }
>
> HTH
>
> A.
>
>
> Alan Rosine wrote:
> >
> > I have a multi-select list box (call it listBox) on a form. When the
user
> > selects one or more items in the list and clicks the submit button the
items
> > are passed into the receiving script as an array. The problem is I
can't
> > seem to access the length property to determine how many entries are in
the
> > array. I've tried...
> >
> > document.value.listBox.length
> > ----
> > var myArray = document.value.listBox
> > var len = myArray.length
> > ---
> > var myArray = new Array()
> > myArray = document.value.listBox
> > var len = myArray.length
> >
> > Regardless of what I try I get an error trying to access the length
property
> > and an len variable with an undefined value.
> >
> > Any help would be appreciated.
> >
> > TIA
> > Alan Rosine
>
> --
> __________________________
>
> Adam Simmonds [TeamSybase]
> System Architect
> ITS FLEXSIS PROJECT
> The University of Sydney
> Phone: +61 2 9351 5174
> Mobile: +61 403 341 474
> Fax: +61 2 9351 7711


Adam Simmonds [TeamSybase] Posted on 2001-07-26 15:02:09.0Z
Newsgroups: sybase.public.powersite
Date: Fri, 27 Jul 2001 01:02:09 +1000
From: "Adam Simmonds [TeamSybase]" <asimmond@mail.usyd.edu.au>
Reply-To: adam.simmonds@teamsybase.com
Organization: University Of Sydney
X-Mailer: Mozilla 4.76 [en] (WinNT; U)
X-Accept-Language: en
MIME-Version: 1.0
Subject: Re: Passing the selections from a list box
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 76
NNTP-Posting-Host: nat-41.mp.usyd.edu.au 129.78.4.41
Message-ID: <382_3B6030F1.6DA81695@mail.usyd.edu.au>
References: <382_Frc7BwWFBHA.201@forums.sybase.com> <382_3B60085F.76310F41@mail.usyd.edu.au> <382_XM2$6beFBHA.201@forums.sybase.com>
Path: forums-1-dub!forums-1-dub!forums-master.sybase.com!forums.sybase.com
Xref: forums-1-dub sybase.public.powersite:138
Article PK: 862568

Sorry I thought you were using a HTMLDW that had a list box on it DOH!

I would assume the same code to access a list box should work?
Can you post the script?

A.

Alan Rosine wrote:
>
> I don't have (or can't seem to find) anything that references the dataForm
> of the document object. Your example suggests you are referencing a
> datawindow on a form (htmldw1_dataForm). In your example, what does
> htmldw1_dataForm reference?
>
> My list box is inside a table within the form I am passing. How would I
> reference this?
>
> TIA
> Alan Rosine
>
> "Adam Simmonds [TeamSybase]" <asimmond@mail.usyd.edu.au> wrote in message
> news:3B60085F.76310F41@mail.usyd.edu.au...
> > I achieved this a while back by accessing the dataForm as follows. The
> > column name is appended with a _0
> >
> > numOptions = document.htmldw1_dataForm.international_typeid_0.length;
> >
> > My full script is as follows ( it is called to grab the values from the
> > select box and add them to a computed column on the htmldw so the server
> > gets all the values )
> >
> > function savechanges()
> > {
> >
> > var options = '';
> > numOptions = document.htmldw1_dataForm.international_typeid_0.length;
> > for ( x=0; x<numOptions; x++ )
> > {
> > selected =
> > document.htmldw1_dataForm.international_typeid_0[x].selected
> > value = document.htmldw1_dataForm.international_typeid_0[x].value
> > options = options + value + "|" + selected + ","
> > }
> >
> > htmldw1.SetItem( 1, "selectedvalues", options );
> >
> > htmldw1.AcceptText()
> > htmldw1.Update()
> > htmldw1.restoreFocus()
> > }
> >
> > HTH
> >
> > A.
> >
> >
> > Alan Rosine wrote:
> > >
> > > I have a multi-select list box (call it listBox) on a form. When the
> user
> > > selects one or more items in the list and clicks the submit button the
> items
> > > are passed into the receiving script as an array. The problem is I
> can't
> > > seem to access the length property to determine how many entries are in
> the
> > > array. I've tried...
> > >
> > > document.value.listBox.length
> > > ----
> > > var myArray = document.value.listBox
> > > var len = myArray.length
> > > ---
> > > var myArray = new Array()
> > > myArray = document.value.listBox
> > > var len = myArray.length
> > >
> > > Regardless of what I try I get an error trying to access the length
> property
> > > and an len variable with an undefined value.
> > >
> > > Any help would be appreciated.
> > >
> > > TIA
> > > Alan Rosine
> >
> > --
> > __________________________
> >
> > Adam Simmonds [TeamSybase]
> > System Architect
> > ITS FLEXSIS PROJECT
> > The University of Sydney
> > Phone: +61 2 9351 5174
> > Mobile: +61 403 341 474
> > Fax: +61 2 9351 7711

--
__________________________

Adam Simmonds [TeamSybase]
System Architect
ITS FLEXSIS PROJECT
The University of Sydney
Phone: +61 2 9351 5174
Mobile: +61 403 341 474
Fax: +61 2 9351 7711


Alan Rosine Posted on 2001-07-26 17:10:23.0Z
Newsgroups: sybase.public.powersite
From: "Alan Rosine" <alan.rosine@dfas.mil>
Subject: Re: Passing the selections from a list box
Date: Thu, 26 Jul 2001 12:10:23 -0500
Lines: 368
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2462.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2462.0000
NNTP-Posting-Host: DNS21z.dfas.mil 207.133.68.234
Message-ID: <382_51HsXkfFBHA.264@forums.sybase.com>
References: <382_Frc7BwWFBHA.201@forums.sybase.com> <382_3B60085F.76310F41@mail.usyd.edu.au> <382_XM2$6beFBHA.201@forums.sybase.com> <382_3B6030F1.6DA81695@mail.usyd.edu.au>
Path: forums-1-dub!forums-1-dub!forums-master.sybase.com!forums.sybase.com
Xref: forums-1-dub sybase.public.powersite:137
Article PK: 862567

Attached are the original page (window.txt) and the script that the page is
sent to (script.txt). Line 56 of the original window accesses a Jaguar
component which is used at lines 83 & 112. The input field at (starting at
line 110) is a listbox with multi-select capability. It is this listbox I
am trying to get working. Select any items in this listbox and click the
Delete Section button. This passes the items selected into the action
script which is then trying to use those values.

Currently I've got several displays (starting at line 48) to use for
debugging in this script that display the following items:
My comments are preceeded by "--" and the (line number) in the script.

-- listArray is the array I define within the script to hold the incoming
array (if needed).
Warning: undefined variable listArray.length[length] near line 61 in
"/sectmaint.stm"
-- (48) I display the incoming array document.value.listSection. This
displays correctly.
Delete Section={ SECTION 2, SECTION 3 }
-- (49-50) I'm testing by selecting 2 entries in the list box so I display
them directly from the incoming value (document.value.listSection[0] & [1].
This displays correctly.
SECTION 2
SECTION 3
-- (51-53) I created an array (new Array()) within the script called
listArray to hold the incoming array since I could not access the length
property of the incoming array. Then I check the length value of the new
array to make sure it is working.
List Section Entries=0
-- (54-55) I created an extra array on the fly called xlistArray to text
this functionality and display its contents. This displays correctly.
xList Entries={ SECTION 2, SECTION 3 }
-- (56-56) I set the contents of listArray using the psDocument.GetParam
method and display the listArray contents. This displays correctly.
List Entries={ SECTION 2, SECTION 3 }
-- (58-59) I display the new values of the listArray(listArray[0] & [1]).
This displays correctly.
SECTION 2
SECTION 3
-- (60) I try to display the length property of the listArray
undefined
-- (61-62) I try set a variable to the value of the length property of the
listArray and display that variable.
List Section Entries=undefined
-- (63) I return to stop processing.

"Adam Simmonds [TeamSybase]" <asimmond@mail.usyd.edu.au> wrote in message
news:3B6030F1.6DA81695@mail.usyd.edu.au...
> Sorry I thought you were using a HTMLDW that had a list box on it DOH!
>
> I would assume the same code to access a list box should work?
> Can you post the script?
>
> A.
>
> Alan Rosine wrote:
> >
> > I don't have (or can't seem to find) anything that references the
dataForm
> > of the document object. Your example suggests you are referencing a
> > datawindow on a form (htmldw1_dataForm). In your example, what does
> > htmldw1_dataForm reference?
> >
> > My list box is inside a table within the form I am passing. How would I
> > reference this?
> >
> > TIA
> > Alan Rosine
> >
> > "Adam Simmonds [TeamSybase]" <asimmond@mail.usyd.edu.au> wrote in
message
> > news:3B60085F.76310F41@mail.usyd.edu.au...
> > > I achieved this a while back by accessing the dataForm as follows. The
> > > column name is appended with a _0
> > >
> > > numOptions = document.htmldw1_dataForm.international_typeid_0.length;
> > >
> > > My full script is as follows ( it is called to grab the values from
the
> > > select box and add them to a computed column on the htmldw so the
server
> > > gets all the values )
> > >
> > > function savechanges()
> > > {
> > >
> > > var options = '';
> > > numOptions = document.htmldw1_dataForm.international_typeid_0.length;
> > > for ( x=0; x<numOptions; x++ )
> > > {
> > > selected =
> > > document.htmldw1_dataForm.international_typeid_0[x].selected
> > > value = document.htmldw1_dataForm.international_typeid_0[x].value
> > > options = options + value + "|" + selected + ","
> > > }
> > >
> > > htmldw1.SetItem( 1, "selectedvalues", options );
> > >
> > > htmldw1.AcceptText()
> > > htmldw1.Update()
> > > htmldw1.restoreFocus()
> > > }
> > >
> > > HTH
> > >
> > > A.
> > >
> > >
> > > Alan Rosine wrote:
> > > >
> > > > I have a multi-select list box (call it listBox) on a form. When
the
> > user
> > > > selects one or more items in the list and clicks the submit button
the
> > items
> > > > are passed into the receiving script as an array. The problem is I
> > can't
> > > > seem to access the length property to determine how many entries are
in
> > the
> > > > array. I've tried...
> > > >
> > > > document.value.listBox.length
> > > > ----
> > > > var myArray = document.value.listBox
> > > > var len = myArray.length
> > > > ---
> > > > var myArray = new Array()
> > > > myArray = document.value.listBox
> > > > var len = myArray.length
> > > >
> > > > Regardless of what I try I get an error trying to access the length
> > property
> > > > and an len variable with an undefined value.
> > > >
> > > > Any help would be appreciated.
> > > >
> > > > TIA
> > > > Alan Rosine
> > >
> > > --
> > > __________________________
> > >
> > > Adam Simmonds [TeamSybase]
> > > System Architect
> > > ITS FLEXSIS PROJECT
> > > The University of Sydney
> > > Phone: +61 2 9351 5174
> > > Mobile: +61 403 341 474
> > > Fax: +61 2 9351 7711
>
> --
> __________________________
>
> Adam Simmonds [TeamSybase]
> System Architect
> ITS FLEXSIS PROJECT
> The University of Sydney
> Phone: +61 2 9351 5174
> Mobile: +61 403 341 474
> Fax: +61 2 9351 7711