kevp75
asked on
Multiple Dynamic Drop-Downs part Duh?
with the help of EE we have a Multiple Dynamic drop-down list generated from a database with a table with the following structure
tableName
catID <-INT(4) Identity
parentID <-INT(4)
catName <-NVARCHAR(255)
the link to the working example is: http://www.portalfanatic.com/temp/temp1.asp
and the link to the code/solution is: https://www.experts-exchange.com/questions/21888212/Multiple-Dynamic-Drop-Downs.html
now the issue at hand is how to get it so the drop-downs disappear. If you select Games, Guild Wars, Guild Halls, The Lost Guild Of Atlantis...then go back up and select User Albums in the 1st drop-down you will see what happens (there will be 2 under it, that shouldn't be there........
Question is, how to cure this?
tableName
catID <-INT(4) Identity
parentID <-INT(4)
catName <-NVARCHAR(255)
the link to the working example is: http://www.portalfanatic.com/temp/temp1.asp
and the link to the code/solution is: https://www.experts-exchange.com/questions/21888212/Multiple-Dynamic-Drop-Downs.html
now the issue at hand is how to get it so the drop-downs disappear. If you select Games, Guild Wars, Guild Halls, The Lost Guild Of Atlantis...then go back up and select User Albums in the 1st drop-down you will see what happens (there will be 2 under it, that shouldn't be there........
Question is, how to cure this?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
@nschafer
perfection, yet again. thank you very much.
@clockwatcher
i didn't ignore your post either, however there is an error that comes up, please see:
http://www.portalfanatic.com/temp/temp2.asp
perfection, yet again. thank you very much.
@clockwatcher
i didn't ignore your post either, however there is an error that comes up, please see:
http://www.portalfanatic.com/temp/temp2.asp
The page that is building the select is returning an error. It appears you named it db2.asp:
http://www.portalfanatic.com/temp/db2.asp
Can't really give you an idea where the error might be since I'm just getting back a 500 Server Error... my guess is maybe a typo in your database connection string or a copy and paste error somewhere. But no worries... you have a solution anyway.
http://www.portalfanatic.com/temp/db2.asp
Can't really give you an idea where the error might be since I'm just getting back a 500 Server Error... my guess is maybe a typo in your database connection string or a copy and paste error somewhere. But no worries... you have a solution anyway.
ASKER
the error that comes up on db2.asp is:
Microsoft OLE DB Provider for SQL Server error '80040e37'
Invalid object name 'invCat'.
/temp/db2.asp, line 22
db2.asp = your selectbuild.asp, and all I did was change the connection string. All of the fields in you code are correct, which make sme wonder why this error would come up?..no typos (just checked, and to be on the safe side, copied the connection string from db1.asp (which is the second page getting the data for nscafer's solution))
(p.s. Turn off Friendly HTTP Error Messages, to see the error)
Microsoft OLE DB Provider for SQL Server error '80040e37'
Invalid object name 'invCat'.
/temp/db2.asp, line 22
db2.asp = your selectbuild.asp, and all I did was change the connection string. All of the fields in you code are correct, which make sme wonder why this error would come up?..no typos (just checked, and to be on the safe side, copied the connection string from db1.asp (which is the second page getting the data for nscafer's solution))
(p.s. Turn off Friendly HTTP Error Messages, to see the error)
Really odd... nothing references an invcat object anywhere near line 22 in the script I posted. Line 22 is "dim rs" -- and is in the middle of the Load method... with no reference to an "invCat" anywhere close. Tried the script on two different computers and just now copied and pasted it on a third and all worked fine for me. Oh well.
ASKER
line 22 is this for me:
rs.open "select icID, parentID, invCat from invCat where icID = " & id & " order by invCat", connstr
I got rid of the option explicit and the white spaces in between that and the rest of the page, which makes me wonder. I'm sitting here looking at the database, ans that is the exact structure. Ususally an error like that comes up if there is a typo, or something in there that shouldn't be, but the line is correct.
It's a bit late here for me to really tinker with it (also got some whobbly pops in me) so I will try to tinker in the mornin
rs.open "select icID, parentID, invCat from invCat where icID = " & id & " order by invCat", connstr
I got rid of the option explicit and the white spaces in between that and the rest of the page, which makes me wonder. I'm sitting here looking at the database, ans that is the exact structure. Ususally an error like that comes up if there is a typo, or something in there that shouldn't be, but the line is correct.
It's a bit late here for me to really tinker with it (also got some whobbly pops in me) so I will try to tinker in the mornin
ASKER
@nschafer
I am going to have to get this question opened again. I just happened to notice the issue is still there.
please have a look at http://www.portalfanatic.com/temp/temp1.asp and cycle down through the Games, Guild Wars, Guild Halls, The Lost Guild Of Atlantis. If you go back up to the game one, and select Dungeon Siege 2 in it, the next drop-down conatins Hall, which should contain nothing, as Hall should be under The Lost Guild Of Atlantis....
I am going to have to get this question opened again. I just happened to notice the issue is still there.
please have a look at http://www.portalfanatic.com/temp/temp1.asp and cycle down through the Games, Guild Wars, Guild Halls, The Lost Guild Of Atlantis. If you go back up to the game one, and select Dungeon Siege 2 in it, the next drop-down conatins Hall, which should contain nothing, as Hall should be under The Lost Guild Of Atlantis....
I posted it at brinkster.
http://watchclocker.brinkster.net/ee/21888438/example.asp
It's a brand new brinkster account (opened 10 minutes ago to post this as a sample) and the DNS server my cable modem is using is having problems resolving the name, but my box at work doesn't have any problems. Give it a try.
http://watchclocker.brinkster.net/ee/21888438/example.asp
It's a brand new brinkster account (opened 10 minutes ago to post this as a sample) and the DNS server my cable modem is using is having problems resolving the name, but my box at work doesn't have any problems. Give it a try.
ASKER
interesting. I will have to look at some tweaking...
I wonder if getting rid of the option explicit makes a difference?
I'm also wondering what version of Microsoft.XMLHTTP?
i'll tweak a bit tomorrow..it's 2am here, and the screen's blurring a bit :)
thanks...
I wonder if getting rid of the option explicit makes a difference?
I'm also wondering what version of Microsoft.XMLHTTP?
i'll tweak a bit tomorrow..it's 2am here, and the screen's blurring a bit :)
thanks...
ASKER
i notice on your example when I select though to Members, I get the resultset of:
cat0 : 2
cat1 : 5
cat2 : 8
cat3 :
how would I make sure to get the last actual ID that was selected?
cat0 : 2
cat1 : 5
cat2 : 8
cat3 :
how would I make sure to get the last actual ID that was selected?
It is... you didn't have anything selected in the last box.
By the way to help track down the problem in yours... ignore the first page and concentrate on db2.asp. You can call it directly-- it will display the select box made up of the children of the id of the passed cat parameter). E.g.,
http://watchclocker.brinkster.net/ee/21888438/selectbuild.asp
displays the root select box
http://watchclocker.brinkster.net/ee/21888438/selectbuild.asp?cat=2
shows the drop down of the children of icID = 2.
Until that page returns a select box the other page won't work.
By the way to help track down the problem in yours... ignore the first page and concentrate on db2.asp. You can call it directly-- it will display the select box made up of the children of the id of the passed cat parameter). E.g.,
http://watchclocker.brinkster.net/ee/21888438/selectbuild.asp
displays the root select box
http://watchclocker.brinkster.net/ee/21888438/selectbuild.asp?cat=2
shows the drop down of the children of icID = 2.
Until that page returns a select box the other page won't work.
ASKER
bingo
like a dummy, it was late and after a few whobbly pops.
Ended up having the wrong tbale info in the queries:
http://www.portalfanatic.com/temp/temp2.asp
i'm still waiting for the mods here to re-open the question
like a dummy, it was late and after a few whobbly pops.
Ended up having the wrong tbale info in the queries:
http://www.portalfanatic.com/temp/temp2.asp
i'm still waiting for the mods here to re-open the question
ASKER
now I guess the question would be, how would I use this in a normal form? I notice the name of the select changes for each drop-down, however all I would really need is the name from the very last drop-down.
I see they are named cat#, however in a situation where there would be multiple depths, how would I request the value of it, not knowing the name of it?
so my situation would be:
this is going to be used in a photo gallery, when a user edits a Pic, they will see this drop-down system, along with the rest of the editting form. My normal way of thinking would be to do:
request.form("picNmae")
request.form("picDesc")
however, I can't very well do this with the categories, as the name changes for each drop-down?
(https://www.experts-exchange.com/questions/21889767/Re-Open-Q.html)
I see they are named cat#, however in a situation where there would be multiple depths, how would I request the value of it, not knowing the name of it?
so my situation would be:
this is going to be used in a photo gallery, when a user edits a Pic, they will see this drop-down system, along with the rest of the editting form. My normal way of thinking would be to do:
request.form("picNmae")
request.form("picDesc")
however, I can't very well do this with the categories, as the name changes for each drop-down?
(https://www.experts-exchange.com/questions/21889767/Re-Open-Q.html)
To get back the selection:
<%
function GetCategorySelection
'returns the last selected category
dim i, retval
retval = ""
i = 0
do while request("cat" & i ) <> ""
retval = request("cat" & i)
i = i + 1
loop
GetCategorySelection = retval
end function
%>
And as for integrating it in a page, if I get a few minutes I'll encapsulate all of it (including writing the client-side javascript) into the class and make it a little nicer/easier to use. Until then, you'd just past the javascript section (or throw into a .js file) from example.asp into any page (html or asp) and add a special empty span and an onload function (to prime the pump) into your form. For example,
sample.html
--------------
<html>
<head>
<script language="javascript" src="AFileContainingTheJSF romAbove.j s"></scrip t>
</head>
<body onload="DoDropDowns(null); ">
<form>
<span id="catdepth0"></span>
</form>
</body>
</html>
<%
function GetCategorySelection
'returns the last selected category
dim i, retval
retval = ""
i = 0
do while request("cat" & i ) <> ""
retval = request("cat" & i)
i = i + 1
loop
GetCategorySelection = retval
end function
%>
And as for integrating it in a page, if I get a few minutes I'll encapsulate all of it (including writing the client-side javascript) into the class and make it a little nicer/easier to use. Until then, you'd just past the javascript section (or throw into a .js file) from example.asp into any page (html or asp) and add a special empty span and an onload function (to prime the pump) into your form. For example,
sample.html
--------------
<html>
<head>
<script language="javascript" src="AFileContainingTheJSF
</head>
<body onload="DoDropDowns(null);
<form>
<span id="catdepth0"></span>
</form>
</body>
</html>
ASKER
q:
I have implemented this, now I am wondering how I can get it to retrieve a value form a querystring to start at a particular category?
I've implemented it to a Photo edit page, and the link to the edit page passes a few value, ie..... ?cat=21?pic=102
how can I get the drop-down to start at cat 21?
I have implemented this, now I am wondering how I can get it to retrieve a value form a querystring to start at a particular category?
I've implemented it to a Photo edit page, and the link to the edit page passes a few value, ie..... ?cat=21?pic=102
how can I get the drop-down to start at cat 21?
ASKER
one more thing I'm wondering is how I can pass the table name as a value to this, that way it can select from a different table if needed
(should this be another question?)
(should this be another question?)
ASKER
please disregard my last post, I've figured out how to pass a table name to it
however,
I have implemented this, now I am wondering how I can get it to retrieve a value form a querystring to start at a particular category?
I've implemented it to a Photo edit page, and the link to the edit page passes a few value, ie..... ?cat=21?pic=102
how can I get the drop-down to start at cat 21?
however,
I have implemented this, now I am wondering how I can get it to retrieve a value form a querystring to start at a particular category?
I've implemented it to a Photo edit page, and the link to the edit page passes a few value, ie..... ?cat=21?pic=102
how can I get the drop-down to start at cat 21?
I've been away from the computer for a copule of days, so I'm not sure where things stand on this question. I'll look at the script again and post back my results. Could you post the data that you are using for this example http://www.portalfanatic.com/temp/temp1.asp. It doesn't appear to be too much, so you could probably just show it here as you did in your orignial question.
Neal.
Neal.
I posted a zip with the updated code at:
https://filedb.experts-exchange.com/incoming/ee-stuff/221-21888438.zip
A working example is at brinkster-- http://watchclocker.brinkster.net/ee/21888438/sample.asp
To start at a different index pass the prefix & "startidx" value to the page. (e.g., http://watchclocker.brinkster.net/ee/21888438/sample.asp?photostartidx=5 )
Here's a look at sample.asp to give you an idea of what it takes to drive the page (if you don't want to download the files):
<!-- #include file="LinkedListToSelectBo x.asp" -->
<%
dim prefix
prefix = "photo"
'pass request(prefix & "startidx") to start deeper in the list
dim multiselect
set multiselect = new CMultiSelect
dim sql 'see the Load method for details
sql = "select icID, parentID, invCat from invCat where icID="
multiselect.Load "Provider=Microsoft.Jet.OL EDB.4.0;Da ta Source=" & server.mappath("./invcat.m db"), sql, "invCat", prefix
%>
<html>
<head>
<%=multiselect.GetClientSi deJS%>
</head>
<body>
<hr>
<%= GetLastMultiSelect(prefix) %>
<hr>
<form>
<%=multiselect.GetInitialS elect%>
<input type="submit">
</form>
</body>
One note, if you decide to use it, you need to make sure that you don't do any writing to the page before you call the multiselect.Load method. Depending on whether or not it's a postback (determined by the presence of the selectupdate variable being passed), the Load method will response.end to just spit out the new selectbox.
https://filedb.experts-exchange.com/incoming/ee-stuff/221-21888438.zip
A working example is at brinkster-- http://watchclocker.brinkster.net/ee/21888438/sample.asp
To start at a different index pass the prefix & "startidx" value to the page. (e.g., http://watchclocker.brinkster.net/ee/21888438/sample.asp?photostartidx=5 )
Here's a look at sample.asp to give you an idea of what it takes to drive the page (if you don't want to download the files):
<!-- #include file="LinkedListToSelectBo
<%
dim prefix
prefix = "photo"
'pass request(prefix & "startidx") to start deeper in the list
dim multiselect
set multiselect = new CMultiSelect
dim sql 'see the Load method for details
sql = "select icID, parentID, invCat from invCat where icID="
multiselect.Load "Provider=Microsoft.Jet.OL
%>
<html>
<head>
<%=multiselect.GetClientSi
</head>
<body>
<hr>
<%= GetLastMultiSelect(prefix)
<hr>
<form>
<%=multiselect.GetInitialS
<input type="submit">
</form>
</body>
One note, if you decide to use it, you need to make sure that you don't do any writing to the page before you call the multiselect.Load method. Depending on whether or not it's a postback (determined by the presence of the selectupdate variable being passed), the Load method will response.end to just spit out the new selectbox.
ASKER
I'll open it up as a new question. Thank you very much for your help.
IE 6
FF 1.504
Opera 8.54
Netscape 8.1
Safari 2.0.3
FF 1.0 (linux)
Neal.