Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 MOD-Group
 MOD Add-On Forum (W/O Code)
 populate droplist
 New Topic  Topic Locked
 Printer Friendly
Next Page
Author Previous Topic Topic Next Topic
Page: of 4

s80ts0465
Junior Member

Italy
290 Posts

Posted - 24 May 2004 :  04:39:52  Show Profile  Send s80ts0465 an ICQ Message
Anybody can suggest me as to populate a dropdown list using the data fixed in a access database ???
I've this code for the dropdown list

If strRqMethod = "Topic" then
	Response.Write	"              <tr>" & vbNewLine & _
		"                <td bgColor=""" & strPopUpTableColor & """ noWrap vAlign=""top"" align=""right""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """><b>Kind of shift</b></font></td>" & vbNewLine & _
		"                <td bgColor=""" & strPopUpTableColor & """><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """>" & vbNewLine & _
		"                <select name=""Injection2"" size=""1"" tabindex=""-1"" >" & vbNewLine & _
		"                	<option value=""" & """>no value</option>" & vbNewLine & _
	Response.Write	"                </select>" & vbNewLine & _
			"                </font></td>" & vbNewLine & _
			"              </tr>" & vbNewLine
End If


but i want that the option value are the record saved in the database

Please help me, i'm getting crazy trying to solve this problem



bye stefano

Carefree
Advanced Member

Philippines
4217 Posts

Posted - 24 May 2004 :  05:10:56  Show Profile
quote:

If strRqMethod = "Topic" then
	Response.Write	"              <tr>" & vbNewLine & _
		"                <td bgColor=""" & strPopUpTableColor & """ noWrap vAlign=""top"" align=""right""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """><b>Kind of shift</b></font></td>" & vbNewLine & _
		"                <td bgColor=""" & strPopUpTableColor & """><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """>" & vbNewLine & _
		"                <select name=""Injection2"" size=""1"" tabindex=""-1"" >" & vbNewLine & _
		"                	<option value=""" & """>no value</option>" & vbNewLine & _
	Response.Write	"                </select>" & vbNewLine & _
			"                </font></td>" & vbNewLine & _
			"              </tr>" & vbNewLine
End If


but i want that the option value are the record saved in the database



Change this line to include the variable of the data:

		"                	<option value=""" & (variable or field here) & """>no value</option>" & vbNewLine & _

Go to Top of Page

s80ts0465
Junior Member

Italy
290 Posts

Posted - 24 May 2004 :  05:35:17  Show Profile  Send s80ts0465 an ICQ Message
i've almost solved :
Set objDC = Server.CreateObject("ADODB.Connection")
  strConn="Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("/NewElogBook/logbook/database/elogbook.mdb")
  objDC.Open strConn
  Set objRS = objDC.Execute("Select PROVA_gruppo FROM FORUM_PROVA")


Response.Write	"              <tr>" & vbNewLine & _
		"                <td bgColor=""" & strPopUpTableColor & """ noWrap vAlign=""top"" align=""right""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """><b>Event:</b></font></td>" & vbNewLine & _
		"                <td bgColor=""" & strPopUpTableColor & """><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """>" & vbNewLine & _
		"                <select name=""Injection1"" size=""1"" tabindex=""-1"" >" & vbNewLine 
if NOT objRs.RecordCount = 0 then
Do While (Not objRs.EOF)		
Response.Write	"                <option value=""" & """>"& PROVA_gruppo &"</option>" & vbNewLine	
	
objRs.MoveNext
Loop
End If

Response.Write	"                </select>" & vbNewLine & _
			"                </font></td>" & vbNewLine & _
			"              </tr>" & vbNewLine

objRs.Close
Set objRs = Nothing
objDC.Close
Set objDC = Nothing



Now i connect to the database and retrive the right data, but the problem is that i'm not able to put them in the dropdownlist (in the red line)

any suggest??

bye stefano

Edited by - s80ts0465 on 24 May 2004 07:18:35
Go to Top of Page

OneWayMule
Dev. Team Member & Support Moderator

Austria
4969 Posts

Posted - 24 May 2004 :  07:22:12  Show Profile  Visit OneWayMule's Homepage  Send OneWayMule an ICQ Message
Try this:
Response.Write	"                <option value=""" & objRS("PROVA_gruppo") & """>" & objRS("PROVA_gruppo") & "</option>" & vbNewLine

My MODs:
Birthdays - Custom Policy - F.A.Q. Administration - Forum Rules - Guestbook
Links Manager - MyOwnGoogle - Profile Views - Search Log - WebSearch

Useful stuff:
Forum and MOD Installation - MOD Installation Guide - Snitz v3.4.05 Readme - Free ASP Hosts - Support Snitz

Edited by - OneWayMule on 24 May 2004 08:55:05
Go to Top of Page

s80ts0465
Junior Member

Italy
290 Posts

Posted - 24 May 2004 :  07:28:15  Show Profile  Send s80ts0465 an ICQ Message
I've just tryed it, but the dropdown list is empty :-((
what to do??
Go to Top of Page

s80ts0465
Junior Member

Italy
290 Posts

Posted - 24 May 2004 :  07:43:25  Show Profile  Send s80ts0465 an ICQ Message
i tryed and re-tryed and have found out this solution
Response.Write " <option value=""" & PROVA_gruppo & """>" & objRS("PROVA_gruppo") & "</option>" & vbNewLine

On this way it populate the dropdown list with the right itmes

bye and thanks
Go to Top of Page

s80ts0465
Junior Member

Italy
290 Posts

Posted - 24 May 2004 :  08:45:42  Show Profile  Send s80ts0465 an ICQ Message
But now that i've found out how to populate the dropdown list i wanna create another a dependent dropdown list. So in a new dropdown list is shown some items is dipendence of the result of the first dropdown list.
These are the 2 dropdown list:
Response.Write	"                <form name = ""Prova"" method=""post"" action=""post.asp"">" & vbNewLine & _
		"		 <tr>" & vbNewLine & _
		"                <td bgColor=""" & strPopUpTableColor & """ noWrap vAlign=""top"" align=""right""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """><b>Event:</b></font></td>" & vbNewLine & _
		"                <td bgColor=""" & strPopUpTableColor & """><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """>" & vbNewLine & _
		"                <select name=""Injection1"" size=""1"" tabindex=""-1"" onchange=Prova.submit()>" & vbNewLine 

Set objDC = Server.CreateObject("ADODB.Connection")
  strConn="Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("/NewElogBook/logbook/database/elogbook.mdb")
  objDC.Open strConn
  Set objRs = objDC.Execute("Select PROVA_gruppo FROM FORUM_PROVA")

if NOT objRs.RecordCount = 0 then
Do While (Not objRs.EOF)		
 
Response.Write " <option value=""" & PROVA_gruppo & """>" & objRs("PROVA_gruppo") & "</option>" & vbNewLine
	
objRs.MoveNext
Loop
End If
Response.Write	"                </select>" & vbNewLine & _
			"                </font></td>" & vbNewLine & _
			"              </form></tr>" & vbNewLine

objRs.Close
Set objRs = Nothing
objDC.Close
Set objDC = Nothing



Response.Write	"                <form name = ""Prova1"" method=""post"" action=""post.asp"">" & vbNewLine & _
		"		 <tr>" & vbNewLine & _
		"                <td bgColor=""" & strPopUpTableColor & """ noWrap vAlign=""top"" align=""right""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """><b>Event:</b></font></td>" & vbNewLine & _
		"                <td bgColor=""" & strPopUpTableColor & """><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """>" & vbNewLine & _
		"                <select name=""Injection3"" size=""1"" tabindex=""-1"" >" & vbNewLine 

Set objDC = Server.CreateObject("ADODB.Connection")
  strConn="Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("/NewElogBook/logbook/database/elogbook.mdb")
  objDC.Open strConn
  Set objRs = objDC.Execute("Select PROVA_fault FROM FORUM_PROVA WHERE PROVA_gruppo= "......")

if NOT objRs.RecordCount = 0 then
Do While (Not objRs.EOF)		
 
Response.Write " <option value=""" & PROVA_fault & """>" & objRs("PROVA_fault") & "</option>" & vbNewLine
	
objRs.MoveNext
Loop
End If
Response.Write	"                </select>" & vbNewLine & _
			"                </font></td>" & vbNewLine & _
			"              </form></tr>" & vbNewLine

objRs.Close
Set objRs = Nothing
objDC.Close
Set objDC = Nothing


what i don't really understand is how to connect the two list. I'd like to use the code in red but i don't know how to set the condition.
I've some doubts about the string onchange =Prova.submit()
I've read somewhere that it should reload the page, but saving the item chosed ????


could you pleaseeeee help me

thanks stefano

Edited by - s80ts0465 on 24 May 2004 09:18:13
Go to Top of Page

OneWayMule
Dev. Team Member & Support Moderator

Austria
4969 Posts

Posted - 24 May 2004 :  08:59:26  Show Profile  Visit OneWayMule's Homepage  Send OneWayMule an ICQ Message
quote:
i tryed and re-tryed and have found out this solution
Response.Write " <option value=""" & PROVA_gruppo & """>" & objRS("PROVA_gruppo") & "</option>" & vbNewLine

You may be able to see it in the dropdown list, but it still has no values.
Take a look at my post above, and make the required changes to your code.

My MODs:
Birthdays - Custom Policy - F.A.Q. Administration - Forum Rules - Guestbook
Links Manager - MyOwnGoogle - Profile Views - Search Log - WebSearch

Useful stuff:
Forum and MOD Installation - MOD Installation Guide - Snitz v3.4.05 Readme - Free ASP Hosts - Support Snitz
Go to Top of Page

OneWayMule
Dev. Team Member & Support Moderator

Austria
4969 Posts

Posted - 24 May 2004 :  09:04:08  Show Profile  Visit OneWayMule's Homepage  Send OneWayMule an ICQ Message
quote:
what i don't really understand is how to connect the two list. I'd like to use the code in red but i don't know how to set the condition.
I've some doubts about the string onchange =Prova.submit()
I've read somewhere that it should reload the page, but saving the item chosed ????

The following code should work:
strsql = "Select PROVA_fault FROM FORUM_PROVA WHERE PROVA_gruppo=" & Request.Form("Injection1")
Set objRs = objDC.Execute(strql)


One question though: Why are both forms getting the same field from the same database table? Makes no sense to me...

My MODs:
Birthdays - Custom Policy - F.A.Q. Administration - Forum Rules - Guestbook
Links Manager - MyOwnGoogle - Profile Views - Search Log - WebSearch

Useful stuff:
Forum and MOD Installation - MOD Installation Guide - Snitz v3.4.05 Readme - Free ASP Hosts - Support Snitz

Edited by - OneWayMule on 24 May 2004 10:05:19
Go to Top of Page

s80ts0465
Junior Member

Italy
290 Posts

Posted - 24 May 2004 :  09:15:40  Show Profile  Send s80ts0465 an ICQ Message
Sorry but it doesn't wanna work
It says
Syntax error(missing operator) in the expression of the query 'PROVA_gruppo ='.
What does it mean??? What to do??


about ur question, sorry i wrote it wrong, the second dropdown list get the value from PROVA_fault field

thanks a lot
Go to Top of Page

OneWayMule
Dev. Team Member & Support Moderator

Austria
4969 Posts

Posted - 24 May 2004 :  10:06:18  Show Profile  Visit OneWayMule's Homepage  Send OneWayMule an ICQ Message
Sorry, I've edited my post above, try it with the new code again.

My MODs:
Birthdays - Custom Policy - F.A.Q. Administration - Forum Rules - Guestbook
Links Manager - MyOwnGoogle - Profile Views - Search Log - WebSearch

Useful stuff:
Forum and MOD Installation - MOD Installation Guide - Snitz v3.4.05 Readme - Free ASP Hosts - Support Snitz
Go to Top of Page

s80ts0465
Junior Member

Italy
290 Posts

Posted - 24 May 2004 :  10:20:02  Show Profile  Send s80ts0465 an ICQ Message
I'm sorry it doesn't work
U wrote
strsql = "Select PROVA_fault FROM FORUM_PROVA WHERE PROVA_gruppo=" & Request.Form("Injection1")
Set objRs = objDC.Execute(strSql)

i've tryed with and without the S but it doesn't work, and when i write the S too, i get the same message error of above

thanks a lot for ur help OneWayMule . do u still have some good ideas??
Go to Top of Page

s80ts0465
Junior Member

Italy
290 Posts

Posted - 24 May 2004 :  17:44:03  Show Profile  Send s80ts0465 an ICQ Message
Hey OneWayMule, any new idea???
i was thinking to create a function in javascript to give the items of the first droplist to the second one. What do u say about it???
Go to Top of Page

OneWayMule
Dev. Team Member & Support Moderator

Austria
4969 Posts

Posted - 24 May 2004 :  18:18:54  Show Profile  Visit OneWayMule's Homepage  Send OneWayMule an ICQ Message
Sorry, I've been sleeping. And when I look at the code I posted, I should've gone to bed earlier.

Anyway, try this:
strsql = "Select PROVA_fault FROM FORUM_PROVA WHERE PROVA_gruppo='" & Request.Form("Injection1") & "'"
Set objRs = objDC.Execute(strSql)


My MODs:
Birthdays - Custom Policy - F.A.Q. Administration - Forum Rules - Guestbook
Links Manager - MyOwnGoogle - Profile Views - Search Log - WebSearch

Useful stuff:
Forum and MOD Installation - MOD Installation Guide - Snitz v3.4.05 Readme - Free ASP Hosts - Support Snitz
Go to Top of Page

s80ts0465
Junior Member

Italy
290 Posts

Posted - 25 May 2004 :  03:50:17  Show Profile  Send s80ts0465 an ICQ Message
Oh sorry i didn't wanna bug u or disturb, but i' in Italy so maybe we have different times sense.
I've just tryed it. Now i don't get any error, but the second dropdown list isn't popultae
Why??? Maybe caused the submit() function ???? How should it work???
Response.Write	"                <form name = ""Prova"" method=""post"" action=""post.asp"">" & vbNewLine & _
		"		 <tr>" & vbNewLine & _
		"                <td bgColor=""" & strPopUpTableColor & """ noWrap vAlign=""top"" align=""right""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """><b>Event:</b></font></td>" & vbNewLine & _
		"                <td bgColor=""" & strPopUpTableColor & """><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """>" & vbNewLine & _
		"                <select name=""Injection1"" size=""1"" tabindex=""-1"" onchange=Prova.submit()>"  & vbNewLine



thanks

Edited by - s80ts0465 on 25 May 2004 04:07:15
Go to Top of Page

OneWayMule
Dev. Team Member & Support Moderator

Austria
4969 Posts

Posted - 25 May 2004 :  06:10:20  Show Profile  Visit OneWayMule's Homepage  Send OneWayMule an ICQ Message
OK, replace this:
strsql = "Select PROVA_fault FROM FORUM_PROVA WHERE PROVA_gruppo='" & Request.Form("Injection1") & "'"
Set objRs = objDC.Execute(strSql)

with
strGruppo = Trim(Request.Form("Injection1"))
If strGruppo = "" Then 
	strsql = "Select PROVA_fault FROM FORUM_PROVA"
Else
	strsql = "Select PROVA_fault FROM FORUM_PROVA WHERE PROVA_gruppo='" & strGruppo & "'"
End If
Set objRs = objDC.Execute(strSql)

My MODs:
Birthdays - Custom Policy - F.A.Q. Administration - Forum Rules - Guestbook
Links Manager - MyOwnGoogle - Profile Views - Search Log - WebSearch

Useful stuff:
Forum and MOD Installation - MOD Installation Guide - Snitz v3.4.05 Readme - Free ASP Hosts - Support Snitz
Go to Top of Page
Page: of 4 Previous Topic Topic Next Topic  
Next Page
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 4.59 seconds. Powered By: Snitz Forums 2000 Version 3.4.07