List box question

P

Paige_Franklin

I have 2 list boxes on a page. Clicking on one causes the value to be moved
to the other box. This works great.

My problem is that I need to values in listbox 2 to be passed to the next
asp page. How do I make all of the items in that second box "selected" ? If
they are selected I can pass them - I don't want the user to have to click on
the items in the second box - I just want the program to know that those are
the choices and send them...right now it only passes them if I select the
items in the second box...
 
T

Thomas A. Rowe

That is how drop down listboxes work, items must be selected.

--
==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, WebCircle, MS KB Quick Links, etc.
==============================================
 
P

Paige_Franklin

I know that and they are selecting items in the first box. I am trying to
figure out a way to set the property of the items in the second box to
selected before I send to the next page. It would be stupid to have a user
have to select items from one box that show up in another box and then make
them select on the second box as well...
 
K

Kevin Spencer

Hi Paige,

Yes, it's true that if they are not selected, they will not be passed.
That's how forms work. If you select a single value, the value will be
passed. If you select multiple values, they will be passed. But if you
select nothing, nothing will be passed.

How do you select them all? Just call something like the following EXAMPLE
function:

<script type="text/javascript"><!--
function selectAll()
{
for (i = 0; i < document.FormName.SelectName.options.length; i++)
document.FormName.SelectName.options.selected = true;
}
// --></script>

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.
 
P

Paige_Franklin

Thank you Thank you Thank you! I don't know javascript and just couldn't get
the code right to make it do that - of course I was making it MUCH too
difficult and had the syntax wrong. I have been stressing over this for
days!

Thank you!!!
Paige

Kevin Spencer said:
Hi Paige,

Yes, it's true that if they are not selected, they will not be passed.
That's how forms work. If you select a single value, the value will be
passed. If you select multiple values, they will be passed. But if you
select nothing, nothing will be passed.

How do you select them all? Just call something like the following EXAMPLE
function:

<script type="text/javascript"><!--
function selectAll()
{
for (i = 0; i < document.FormName.SelectName.options.length; i++)
document.FormName.SelectName.options.selected = true;
}
// --></script>

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.

Paige_Franklin said:
I have 2 list boxes on a page. Clicking on one causes the value to be
moved
to the other box. This works great.

My problem is that I need to values in listbox 2 to be passed to the next
asp page. How do I make all of the items in that second box "selected" ?
If
they are selected I can pass them - I don't want the user to have to click
on
the items in the second box - I just want the program to know that those
are
the choices and send them...right now it only passes them if I select the
items in the second box...
 
P

Paige_Franklin

THANK YOU THANK YOU THANK YOU.

I am just learning asp and a bit of javascript and I just couldn't get the
syntax right - I was making it WAY more difficult than it was - I had tried a
function but I was totally doing it wrong! I have stressed over this for 3
days - I really appreciate your help!

Paige

Kevin Spencer said:
Hi Paige,

Yes, it's true that if they are not selected, they will not be passed.
That's how forms work. If you select a single value, the value will be
passed. If you select multiple values, they will be passed. But if you
select nothing, nothing will be passed.

How do you select them all? Just call something like the following EXAMPLE
function:

<script type="text/javascript"><!--
function selectAll()
{
for (i = 0; i < document.FormName.SelectName.options.length; i++)
document.FormName.SelectName.options.selected = true;
}
// --></script>

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.

Paige_Franklin said:
I have 2 list boxes on a page. Clicking on one causes the value to be
moved
to the other box. This works great.

My problem is that I need to values in listbox 2 to be passed to the next
asp page. How do I make all of the items in that second box "selected" ?
If
they are selected I can pass them - I don't want the user to have to click
on
the items in the second box - I just want the program to know that those
are
the choices and send them...right now it only passes them if I select the
items in the second box...
 
K

Kevin Spencer

Goodness! Thanked twice for one reply! You're welcome! You're welcome!

--

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.

Paige_Franklin said:
THANK YOU THANK YOU THANK YOU.

I am just learning asp and a bit of javascript and I just couldn't get the
syntax right - I was making it WAY more difficult than it was - I had
tried a
function but I was totally doing it wrong! I have stressed over this for
3
days - I really appreciate your help!

Paige

Kevin Spencer said:
Hi Paige,

Yes, it's true that if they are not selected, they will not be passed.
That's how forms work. If you select a single value, the value will be
passed. If you select multiple values, they will be passed. But if you
select nothing, nothing will be passed.

How do you select them all? Just call something like the following
EXAMPLE
function:

<script type="text/javascript"><!--
function selectAll()
{
for (i = 0; i < document.FormName.SelectName.options.length; i++)
document.FormName.SelectName.options.selected = true;
}
// --></script>

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.

message
I have 2 list boxes on a page. Clicking on one causes the value to be
moved
to the other box. This works great.

My problem is that I need to values in listbox 2 to be passed to the
next
asp page. How do I make all of the items in that second box "selected"
?
If
they are selected I can pass them - I don't want the user to have to
click
on
the items in the second box - I just want the program to know that
those
are
the choices and send them...right now it only passes them if I select
the
items in the second box...
 
Top