Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: saving values from multiple combo boxes


Message #1 by elizabetas@m... on Mon, 29 Oct 2001 16:11:16
Sory if I made it confusing but ... I myself don't understand it too well.



I'm strugling with saving values user selected from multiple, dynamicly 

filled option boxes.

I probably need 4 boxes.



First one, does not influence the content of others. I just need to save 

the selected values.



From second one I need to copy selected values in the third box cause here 

they can make multiple selections. Once they selected what they want 

and "moved" the selection to the third box, when they select something 

from third box, the fourth box should list available selections for that 

criteria. In here also they can make multiple selections.



PROBLEM:

all of these selections have to be passed to the next page in the 

multidimensional array like this:



box1selection,

box3selection1, box4selection1, 2, 3 ...

box3selection2, box4selection1, 2, 3 ...

...



It gets more complicated because values from box 4 will be columns and 

there will have to be available functions added to this such as min, max, 

sum, so this also needs to be added in somehow.



I'm thinking this should be done with the ONCHANGE but the other problem 

is making sure that if they made some selection and didn't like results, 

they can start the process again. I have to make sure that only the final 

selection values are saved.



Ihave special problem with saving these in the array, and passing controls 

back and forth from asp to java script. I went through bunch of ASP books 

and could not find a good example of filling the multidimensional array.



all comments are welcome,

Thank you for your time, I REALLY appreciate it!!!

Message #2 by "Andrew Haslett" <scooter@p...> on Tue, 30 Oct 2001 09:41:33 +1030
Hi Elizabetas



I don't understand why you would want to 'COPY' any values from one box to

another as you already know what is selected and can use this value in your

next page. You don't need to COPY it to the next box to use it as a

reference to lookup the depending values in the next listbox..



How are you wishing to pass the values.. through a form (POST) or a

querystring (GET).  Why not just take the values as they are, in the form

and on the next page, transfer it to an array.  Or initially pass the values

to a separate page (or itself), where you can transform the values into an

array and then send it on the to page you are talking about.



That said, these links may help you:

http://www.atgconsulting.com/doublelist.asp

http://www.atgconsulting.com/triplelist.asp

http://www.atgconsulting.com/gofetch.asp

http://www.atgconsulting.com/funpopup2.asp



Hope this helps,

Andrew



-----Original Message-----

From: elizabetas@m... [mailto:elizabetas@m...]

Sent: Monday, 29 October 2001 4:11 PM

To: ASP Databases

Subject: [asp_databases] saving values from multiple combo boxes





Sory if I made it confusing but ... I myself don't understand it too well.



I'm strugling with saving values user selected from multiple, dynamicly

filled option boxes.

I probably need 4 boxes.



First one, does not influence the content of others. I just need to save

the selected values.



From second one I need to copy selected values in the third box cause here

they can make multiple selections. Once they selected what they want

and "moved" the selection to the third box, when they select something

from third box, the fourth box should list available selections for that

criteria. In here also they can make multiple selections.



PROBLEM:

all of these selections have to be passed to the next page in the

multidimensional array like this:



box1selection,

box3selection1, box4selection1, 2, 3 ...

box3selection2, box4selection1, 2, 3 ...

...



It gets more complicated because values from box 4 will be columns and

there will have to be available functions added to this such as min, max,

sum, so this also needs to be added in somehow.



I'm thinking this should be done with the ONCHANGE but the other problem

is making sure that if they made some selection and didn't like results,

they can start the process again. I have to make sure that only the final

selection values are saved.



Ihave special problem with saving these in the array, and passing controls

back and forth from asp to java script. I went through bunch of ASP books

and could not find a good example of filling the multidimensional array.



all comments are welcome,

Thank you for your time, I REALLY appreciate it!!!








$subst('Email.Unsub')







Message #3 by Elizabeta Siljanovski <elizabetas@m...> on Tue, 30 Oct 2001 11:15:53 -0800
I checked out these already. the problem with them is that they only let 

the user pick one thing and if they pick something else, the previous 

selection is gone.

basicaly, what I need is:



First box = dynamicly produced drop down menu, they can make one 

selection. this one does not influence any other boxes, I just need the 

selection saved.

Second = dynamicly produced drop down menu, this time depending on what 

they select third box pops up with new selection choices. from here 

however they can make multiple selections and each selection should open 

new box where they can make one selection.



so, i need to save the first box selection, I also need to save each 

selection from box that poped up when they made second selection, and 

also the last selection from the last box.



the whole thing would look something like this:

selection from first box

first selection from the third box , first selection from fourth box

second selection from the third box, secon selection from the fourth box

etc.



this whole thing has to be passed to the next page and there i make 

another SQL select statement from this.



If you have better ideas on how to do this let me know, I would really 

appreciate it.











Andrew Haslett wrote:



>Hi Elizabetas

>

>I don't understand why you would want to 'COPY' any values from one box to

>another as you already know what is selected and can use this value in your

>next page. You don't need to COPY it to the next box to use it as a

>reference to lookup the depending values in the next listbox..

>

>How are you wishing to pass the values.. through a form (POST) or a

>querystring (GET).  Why not just take the values as they are, in the form

>and on the next page, transfer it to an array.  Or initially pass the values

>to a separate page (or itself), where you can transform the values into an

>array and then send it on the to page you are talking about.

>

>That said, these links may help you:

>http://www.atgconsulting.com/doublelist.asp

>http://www.atgconsulting.com/triplelist.asp

>http://www.atgconsulting.com/gofetch.asp

>http://www.atgconsulting.com/funpopup2.asp

>

>Hope this helps,

>Andrew

>

>-----Original Message-----

>From: elizabetas@m... [mailto:elizabetas@m...]

>Sent: Monday, 29 October 2001 4:11 PM

>To: ASP Databases

>Subject: [asp_databases] saving values from multiple combo boxes

>

>

>Sory if I made it confusing but ... I myself don't understand it too well.

>

>I'm strugling with saving values user selected from multiple, dynamicly

>filled option boxes.

>I probably need 4 boxes.

>

>First one, does not influence the content of others. I just need to save

>the selected values.

>

>>From second one I need to copy selected values in the third box cause here

>they can make multiple selections. Once they selected what they want

>and "moved" the selection to the third box, when they select something

>from third box, the fourth box should list available selections for that

>criteria. In here also they can make multiple selections.

>

>PROBLEM:

>all of these selections have to be passed to the next page in the

>multidimensional array like this:

>

>box1selection,

>box3selection1, box4selection1, 2, 3 ...

>box3selection2, box4selection1, 2, 3 ...

>...

>

>It gets more complicated because values from box 4 will be columns and

>there will have to be available functions added to this such as min, max,

>sum, so this also needs to be added in somehow.

>

>I'm thinking this should be done with the ONCHANGE but the other problem

>is making sure that if they made some selection and didn't like results,

>they can start the process again. I have to make sure that only the final

>selection values are saved.

>

>Ihave special problem with saving these in the array, and passing controls

>back and forth from asp to java script. I went through bunch of ASP books

>and could not find a good example of filling the multidimensional array.

>

>all comments are welcome,

>Thank you for your time, I REALLY appreciate it!!!

Message #4 by "Andrew Haslett" <scooter@p...> on Wed, 31 Oct 2001 09:38:07 +1030
ah ok.  gotchya now. Sorry.



I think the easiest method would be to use the external page option similar

to http://www.atgconsulting.com/funpopup2.asp.  There's no reason why you

can't incorporate a linked list (as in

http://www.atgconsulting.com/doublelist.asp) into the external page and send

back the 'joint' values to a single list box on the main page.  Get my

drift?



So in summary you will only need three listboxes on the main page. (I'm

assuming that once the value in the second box is selected, it doesn't

change):



Listbox 1 - simple selection, no further action required (stored in form

variable on final submit).



Listbox 2 - once the value is selected it automatically opens an external

window (passing the selected value in the querystring).



Listbox 3 - houses a list of 'combination values' selected from the external

window. Therefore the user should not be able to enter this listbox (hint:

use ONBLUR())



The external window houses a linked list box (as seen in article above -

'doublelist'), of which the first listbox is populated by the value from the

querystring. It also contains a 'SEND' button which sends BOTH selected

values back to the main page, and a 'CLOSE WINDOW' button.  So basically,

the user selects an option in the first listbox in the external page, which

populates the second listbox. After selecting the desired option in the

second listbox, the user then clicks the 'SEND' button which sends BOTH

values back to the main page and places them in listbox 3.  The user can

repeat this step as many times as required and when finished, hits the

'CLOSE WINDOW' button.



SO there you have it. Most of the code is provided in those articles. You

just need to add a few buttons, and adapt the code to your needs. You'd also

need to add a bit of error handling in there though, such as making sure the

user selects both options in the external window before 'SEND'ing, otherwise

you will get a list of blank values in your LISTBOX 3.



When the user finally submits the main form you will have data of the

following form submitted:



Listbox 1 -> One value only



Listbox 2 -> One value only



Listbox 3 -> 	selectionA, CorrespondingSelectionA

		selectionA, CorrespondingSelectionC

		selectionA, CorrespondingSelectionF

		selectionB, CorrespondingSelectionB

		selectionC, CorrespondingSelectionA

		selectionC, CorrespondingSelectionD

		selectionC, CorrespondingSelectionB

		selectionC, CorrespondingSelectionC



Is this on the right track? I'm not sure as to your extended requirements

such as MIN, MAX etc, however since the external page is separate you could

add whatever other type of complexities without harming the original form.



HTH,



Andrew



-----Original Message-----

From: Elizabeta Siljanovski [mailto:elizabetas@m...]

Sent: Wednesday, 31 October 2001 5:46 AM

To: ASP Databases

Subject: [asp_databases] RE: saving values from multiple combo boxes





I checked out these already. the problem with them is that they only let

the user pick one thing and if they pick something else, the previous

selection is gone.

basicaly, what I need is:



First box = dynamicly produced drop down menu, they can make one

selection. this one does not influence any other boxes, I just need the

selection saved.

Second = dynamicly produced drop down menu, this time depending on what

they select third box pops up with new selection choices. from here

however they can make multiple selections and each selection should open

new box where they can make one selection.



so, i need to save the first box selection, I also need to save each

selection from box that poped up when they made second selection, and

also the last selection from the last box.



the whole thing would look something like this:

selection from first box

first selection from the third box , first selection from fourth box

second selection from the third box, secon selection from the fourth box

etc.



this whole thing has to be passed to the next page and there i make

another SQL select statement from this.



If you have better ideas on how to do this let me know, I would really

appreciate it.











Andrew Haslett wrote:



>Hi Elizabetas

>

>I don't understand why you would want to 'COPY' any values from one box to

>another as you already know what is selected and can use this value in your

>next page. You don't need to COPY it to the next box to use it as a

>reference to lookup the depending values in the next listbox..

>

>How are you wishing to pass the values.. through a form (POST) or a

>querystring (GET).  Why not just take the values as they are, in the form

>and on the next page, transfer it to an array.  Or initially pass the

values

>to a separate page (or itself), where you can transform the values into an

>array and then send it on the to page you are talking about.

>

>That said, these links may help you:

>http://www.atgconsulting.com/doublelist.asp

>http://www.atgconsulting.com/triplelist.asp

>http://www.atgconsulting.com/gofetch.asp

>http://www.atgconsulting.com/funpopup2.asp

>

>Hope this helps,

>Andrew

>

>-----Original Message-----

>From: elizabetas@m... [mailto:elizabetas@m...]

>Sent: Monday, 29 October 2001 4:11 PM

>To: ASP Databases

>Subject: [asp_databases] saving values from multiple combo boxes

>

>

>Sory if I made it confusing but ... I myself don't understand it too well.

>

>I'm strugling with saving values user selected from multiple, dynamicly

>filled option boxes.

>I probably need 4 boxes.

>

>First one, does not influence the content of others. I just need to save

>the selected values.

>

>>From second one I need to copy selected values in the third box cause here

>they can make multiple selections. Once they selected what they want

>and "moved" the selection to the third box, when they select something

>from third box, the fourth box should list available selections for that

>criteria. In here also they can make multiple selections.

>

>PROBLEM:

>all of these selections have to be passed to the next page in the

>multidimensional array like this:

>

>box1selection,

>box3selection1, box4selection1, 2, 3 ...

>box3selection2, box4selection1, 2, 3 ...

>...

>

>It gets more complicated because values from box 4 will be columns and

>there will have to be available functions added to this such as min, max,

>sum, so this also needs to be added in somehow.

>

>I'm thinking this should be done with the ONCHANGE but the other problem

>is making sure that if they made some selection and didn't like results,

>they can start the process again. I have to make sure that only the final

>selection values are saved.

>

>Ihave special problem with saving these in the array, and passing controls

>back and forth from asp to java script. I went through bunch of ASP books

>and could not find a good example of filling the multidimensional array.

>

>all comments are welcome,

>Thank you for your time, I REALLY appreciate it!!!




  Return to Index