forcing everything to be selected

M

middletree

I have a multiple select box, and I'd like to find a way to pass all items
in the list to the next page. I assume the only way this can happen is if
all are selected. Unfortunately, I have found that it is possible for the
user to click one item, which de-selects all the others. I need some code
which will make 100% that all items in the list are selected upon
submission. I assume there may be a javascript function I could build and
put into the onlick event of the submit button (really it's an image)

I know that this is not a javascript group or a client-side group, but was
wondering if someone here might know what it would take to make this form
field do a select all just before submission.

An IE-only solution would be fine.
 
S

Steven Burn

We working with radio or checkbox here.....?

--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

Personal favourites

WebGrid - www.webgrid.co.uk
Freeware Arena - www.freewarearena.com
Freeware Home - www.freewarehome.com
Freeware Outpost -
http://free.hostdepartment.com/f/freewareoutpost/index2.html
ZeroPlus2 - http://zp2.it-mate.co.uk
Fort Freeware - http://freeware.quantum.2ya.com/
Pricelessware - http://www.pricelessware.org
El-Mambo - http://www.el-mambo.net/
Practically Nerded - http://mvps.org/PracticallyNerded/
Bugs, Glitches n stuff - http://mvps.org/inetexplorer/Darnit.htm
Calendar of Updates - http://www.dozleng.com/updates/index.php?&act=calendar
Seniority - http://www.seniority.co.uk
Remembering Dunblane - http://www.dunblane.braveheart.com/
Echo Echo - http://www.echoecho.com/
 
B

Bob Barrows

middletree said:
I have a multiple select box, and I'd like to find a way to pass all
items in the list to the next page. I assume the only way this can
happen is if all are selected. Unfortunately, I have found that it is
possible for the user to click one item, which de-selects all the
others. I need some code which will make 100% that all items in the
list are selected upon submission.

Why not use a hidden copy of the select box with all the items selected so
that the user never gets to deselect them?
I assume there may be a javascript
function I could build and put into the onlick event of the submit
button (really it's an image)

I know that this is not a javascript group or a client-side group,

So why aren't you posting this question to one of those groups?
but was wondering if someone here might know what it would take to
make this form field do a select all just before submission.

Yes, I do know. And I would be happy to post that solution in the relevant
newsgroup. (hint:
http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/selectedindex.asp)

Bob Barrows
 
M

middletree

Comments inline:

"Bob Barrows"
Why not use a hidden copy of the select box with all the items selected so
that the user never gets to deselect them?

I didn't know you could mark a select box as hidden. Unless you mean putting
them into a div which is not visible. Won't work in this case, though. I
guess I need to post a page to explain what I'm doing. I'll do that Monday.
So why aren't you posting this question to one of those groups?

For 2 reasons:
1. I haven't found a js group that has been very helpful. I'm not saying
they're not out there, but I just haven't found them.
2. This does have to do with passing a form element onto another page, so
that ASP code can capture, it, so it kinda fit. At the very least, there may
be someone here who has done such a thing and could help.

Yes, I do know. And I would be happy to post that solution in the relevant
newsgroup.

And what group would that be?

I'll check it out; thanks.
 
B

Bob Barrows

middletree said:
Comments inline:

"Bob Barrows"

I didn't know you could mark a select box as hidden.

Of course you can. Use the Visible style property.
For 2 reasons:
1. I haven't found a js group that has been very helpful. I'm not
saying they're not out there, but I just haven't found them.

I've never seen a post from you in .scripting.jscript, or any of the groups
with "dhtml" in their names, so I don't know how you can be passing
judgement on these groups.
2. This does have to do with passing a form element onto another
page, so that ASP code can capture, it, so it kinda fit.

No it doesn't. It has to do with setting the value of an element in
client-side code. You could do the same thing in a .htm page. It is not an
ASP issue.
And what group would that be?

See above.

Bob Barrows
 
M

middletree

Bob Barrows said:
Of course you can. Use the Visible style property.

Like I said in the part that you snipped, that won't work in this case.
I've never seen a post from you in .scripting.jscript, or any of the groups
with "dhtml" in their names, so I don't know how you can be passing
judgement on these groups.

Please re-read what I said. I said if there are helpful ones out there, I
haven't found them. I never thought to do a search for groups with DHTML in
them, or JScript. I was looking for Javascript. That is not the same as
passing judgment.

But since you mentioned it, I did do a search for groups on Microsoft's
forums (as opposed to Usenet, where I was looking) with either DHTML or
JScript in the names. I can try and post to one of them. BUt mosdt of the
ones I saw seemed like they had extremely infrequent posts, so that makes me
think that it could be a while before anyone sees my question. But it won't
hurt to give it a try.
No it doesn't. It has to do with setting the value of an element in
client-side code. You could do the same thing in a .htm page. It is not an
ASP issue.

Well, like I said in the part you snipped, I felt like I might find an
answer here, like asking the guy in the electrical department at Home Depot
if he can help me find the hammers. If he happens to know, great. If not,
I'll keep looking.

This article didn't help me find out how to automatically set the desired
property of my form element. But thanks anyway.
 
R

roger

I have a multiple select box, and I'd like to find a way to pass all items
in the list to the next page.

Does this work?

<input type='hidden' name=select1 value='1'>
<input type='hidden' name=select1 value='2'>

<select multiple>
<option value='1' selected>x</option>
<option value='2' selected>y</option>
</select>

i.e. show the select box, but ignore it on the next page.
 
M

middletree

No, it won't work.

I can't know ahead of time how many selections there will be, so I can't
program how many hiddne fields there iwll be. But more important, I have to
give users th opportunity to determine how many selections will be in that
box, and that happens after page load.

I'll post a sample page and will probably start a new thread.
 
M

middletree

Got the answer from Bob, on another forum.

roger said:
Does this work?

<input type='hidden' name=select1 value='1'>
<input type='hidden' name=select1 value='2'>

<select multiple>
<option value='1' selected>x</option>
<option value='2' selected>y</option>
</select>

i.e. show the select box, but ignore it on the next page.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,147
Messages
2,570,835
Members
47,383
Latest member
EzraGiffor

Latest Threads

Top