By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,213 Members | 1,105 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,213 IT Pros & Developers. It's quick & easy.

Display User Selection From Combo Box

P: n/a
Hi

I'm sure this is a very trivial problem!
I have a combo bound to a recordset. I was wondering how I can show the
value on the page, what the user has selected?
The code that I'm using is below.
Any help, would be much apprceciated.

Kind regards

--
Kind Regards

Rikesh
(V.InterDev6.0-SP5/W2K-SP4/SQL2K-SP3)

<%

Dim objConnection 'The connection object
Dim objRecordset 'The recordset object

' create the Connection object
Set objConnection = Server.CreateObject("ADODB.Connection")
' open the DSN
objConnection.Open "Provider=sqloledb;" & _
"Data Source=DEVSVR;" & _
"Initial Catalog=pubs;" & _
"User Id=sa;" & _
"Password=admin"

' creates the recordset object
Set objRecordset = Server.CreateObject("ADODB.Recordset")

' SQL String for query
Dim strSQL
strSQL = "SELECT au_id, au_lname FROM Authors"

' execute the SQL statement that you want
' The query should return all the data you'll
' need in your combo box
objRecordset.Open strSQL, objConnection

Request.Form("au_lname")
Response.Write (Request.Form("au_lname"))

%>
<HTML>
<BODY>
<FORM ACTION="DBCombo.asp" METHOD=POST>
<select name=cboPrimary size=1 >
<!--onChange="frmTest.submit();"> -->
Choose from the combo:
select name="lstTopic" size="1">
<%
' while we don't get the end of DataBase
Do While Not objRecordset.EOF
'we put the ID at Value
'this value is important to linked tables
%>
<option VALUE="<%=objRecordset("au_ID")%>">
<!-- This is what will appear in the combo box -->
<%=objRecordset("au_lname")%>
</option>
<%
' Move to the next record...
objRecordset.MoveNext
Loop ' keep the loop
%>
</SELECT>
</FORM>
</BODY>
</HTML>
<%
' close the recordset object
objRecordset.Close

' clean the Recordset object
Set objRecordset = Nothing
%>

Jul 19 '05 #1
Share this Question
Share on Google+
8 Replies


P: n/a
Do you want to the selection to be displayed on the same page as the form?
or after the fgorm has been submitted?

if it's the first then it is a client side issue and you will have a better
response from a client side or javascript newsgroup
"rikesh" <ri**********@website.com> wrote in message
news:u8**************@TK2MSFTNGP09.phx.gbl...
Hi

I'm sure this is a very trivial problem!
I have a combo bound to a recordset. I was wondering how I can show the
value on the page, what the user has selected?
The code that I'm using is below.
Any help, would be much apprceciated.

Kind regards

--
Kind Regards

Rikesh
(V.InterDev6.0-SP5/W2K-SP4/SQL2K-SP3)

<%

Dim objConnection 'The connection object
Dim objRecordset 'The recordset object

' create the Connection object
Set objConnection = Server.CreateObject("ADODB.Connection")
' open the DSN
objConnection.Open "Provider=sqloledb;" & _
"Data Source=DEVSVR;" & _
"Initial Catalog=pubs;" & _
"User Id=sa;" & _
"Password=admin"

' creates the recordset object
Set objRecordset = Server.CreateObject("ADODB.Recordset")

' SQL String for query
Dim strSQL
strSQL = "SELECT au_id, au_lname FROM Authors"

' execute the SQL statement that you want
' The query should return all the data you'll
' need in your combo box
objRecordset.Open strSQL, objConnection

Request.Form("au_lname")
Response.Write (Request.Form("au_lname"))

%>
<HTML>
<BODY>
<FORM ACTION="DBCombo.asp" METHOD=POST>
<select name=cboPrimary size=1 >
<!--onChange="frmTest.submit();"> -->
Choose from the combo:
select name="lstTopic" size="1">
<%
' while we don't get the end of DataBase
Do While Not objRecordset.EOF
'we put the ID at Value
'this value is important to linked tables
%>
<option VALUE="<%=objRecordset("au_ID")%>">
<!-- This is what will appear in the combo box -->
<%=objRecordset("au_lname")%>
</option>
<%
' Move to the next record...
objRecordset.MoveNext
Loop ' keep the loop
%>
</SELECT>
</FORM>
</BODY>
</HTML>
<%
' close the recordset object
objRecordset.Close

' clean the Recordset object
Set objRecordset = Nothing
%>

Jul 19 '05 #2

P: n/a
Yeah, I would prefer on the same page!
So does that it's a client issue?

"Alex Goodey" <ag*****@hsfinancial.co.uk> wrote in message
news:bv*************@ID-221525.news.uni-berlin.de...
Do you want to the selection to be displayed on the same page as the form?
or after the fgorm has been submitted?

if it's the first then it is a client side issue and you will have a better response from a client side or javascript newsgroup
"rikesh" <ri**********@website.com> wrote in message
news:u8**************@TK2MSFTNGP09.phx.gbl...
Hi

I'm sure this is a very trivial problem!
I have a combo bound to a recordset. I was wondering how I can show the
value on the page, what the user has selected?
The code that I'm using is below.
Any help, would be much apprceciated.

Kind regards

--
Kind Regards

Rikesh
(V.InterDev6.0-SP5/W2K-SP4/SQL2K-SP3)

<%

Dim objConnection 'The connection object
Dim objRecordset 'The recordset object

' create the Connection object
Set objConnection = Server.CreateObject("ADODB.Connection")
' open the DSN
objConnection.Open "Provider=sqloledb;" & _
"Data Source=DEVSVR;" & _
"Initial Catalog=pubs;" & _
"User Id=sa;" & _
"Password=admin"

' creates the recordset object
Set objRecordset = Server.CreateObject("ADODB.Recordset")

' SQL String for query
Dim strSQL
strSQL = "SELECT au_id, au_lname FROM Authors"

' execute the SQL statement that you want
' The query should return all the data you'll
' need in your combo box
objRecordset.Open strSQL, objConnection

Request.Form("au_lname")
Response.Write (Request.Form("au_lname"))

%>
<HTML>
<BODY>
<FORM ACTION="DBCombo.asp" METHOD=POST>
<select name=cboPrimary size=1 >
<!--onChange="frmTest.submit();"> -->
Choose from the combo:
select name="lstTopic" size="1">
<%
' while we don't get the end of DataBase
Do While Not objRecordset.EOF
'we put the ID at Value
'this value is important to linked tables
%>
<option VALUE="<%=objRecordset("au_ID")%>">
<!-- This is what will appear in the combo box -->
<%=objRecordset("au_lname")%>
</option>
<%
' Move to the next record...
objRecordset.MoveNext
Loop ' keep the loop
%>
</SELECT>
</FORM>
</BODY>
</HTML>
<%
' close the recordset object
objRecordset.Close

' clean the Recordset object
Set objRecordset = Nothing
%>


Jul 19 '05 #3

P: n/a
yep, do a search on google and you will probably find what you are looking
for.

it will be something to do with the onChange event of the drop down, or
something like that

"rikesh" <ri**********@website.com> wrote in message
news:u$**************@TK2MSFTNGP11.phx.gbl...
Yeah, I would prefer on the same page!
So does that it's a client issue?

"Alex Goodey" <ag*****@hsfinancial.co.uk> wrote in message
news:bv*************@ID-221525.news.uni-berlin.de...
Do you want to the selection to be displayed on the same page as the form? or after the fgorm has been submitted?

if it's the first then it is a client side issue and you will have a

better
response from a client side or javascript newsgroup
"rikesh" <ri**********@website.com> wrote in message
news:u8**************@TK2MSFTNGP09.phx.gbl...
Hi

I'm sure this is a very trivial problem!
I have a combo bound to a recordset. I was wondering how I can show the value on the page, what the user has selected?
The code that I'm using is below.
Any help, would be much apprceciated.

Kind regards

--
Kind Regards

Rikesh
(V.InterDev6.0-SP5/W2K-SP4/SQL2K-SP3)

<%

Dim objConnection 'The connection object
Dim objRecordset 'The recordset object

' create the Connection object
Set objConnection = Server.CreateObject("ADODB.Connection")
' open the DSN
objConnection.Open "Provider=sqloledb;" & _
"Data Source=DEVSVR;" & _
"Initial Catalog=pubs;" & _
"User Id=sa;" & _
"Password=admin"

' creates the recordset object
Set objRecordset = Server.CreateObject("ADODB.Recordset")

' SQL String for query
Dim strSQL
strSQL = "SELECT au_id, au_lname FROM Authors"

' execute the SQL statement that you want
' The query should return all the data you'll
' need in your combo box
objRecordset.Open strSQL, objConnection

Request.Form("au_lname")
Response.Write (Request.Form("au_lname"))

%>
<HTML>
<BODY>
<FORM ACTION="DBCombo.asp" METHOD=POST>
<select name=cboPrimary size=1 >
<!--onChange="frmTest.submit();"> -->
Choose from the combo:
select name="lstTopic" size="1">
<%
' while we don't get the end of DataBase
Do While Not objRecordset.EOF
'we put the ID at Value
'this value is important to linked tables
%>
<option VALUE="<%=objRecordset("au_ID")%>">
<!-- This is what will appear in the combo box -->
<%=objRecordset("au_lname")%>
</option>
<%
' Move to the next record...
objRecordset.MoveNext
Loop ' keep the loop
%>
</SELECT>
</FORM>
</BODY>
</HTML>
<%
' close the recordset object
objRecordset.Close

' clean the Recordset object
Set objRecordset = Nothing
%>



Jul 19 '05 #4

P: n/a

"rikesh" <ri**********@website.com> wrote in message
news:u8**************@TK2MSFTNGP09.phx.gbl...
Hi

I'm sure this is a very trivial problem!
I have a combo bound to a recordset. I was wondering how I can show the
value on the page, what the user has selected?
The code that I'm using is below.
Any help, would be much apprceciated.

Kind regards

--
Kind Regards

Rikesh
(V.InterDev6.0-SP5/W2K-SP4/SQL2K-SP3)

<%

Dim objConnection 'The connection object
Dim objRecordset 'The recordset object

' create the Connection object
Set objConnection = Server.CreateObject("ADODB.Connection")
' open the DSN
objConnection.Open "Provider=sqloledb;" & _
"Data Source=DEVSVR;" & _
"Initial Catalog=pubs;" & _
"User Id=sa;" & _
"Password=admin"

' creates the recordset object
Set objRecordset = Server.CreateObject("ADODB.Recordset")

' SQL String for query
Dim strSQL
strSQL = "SELECT au_id, au_lname FROM Authors"

' execute the SQL statement that you want
' The query should return all the data you'll
' need in your combo box
objRecordset.Open strSQL, objConnection

Request.Form("au_lname")
Response.Write (Request.Form("au_lname"))

%>
<HTML>
<BODY>
<FORM ACTION="DBCombo.asp" METHOD=POST>
<select name=cboPrimary size=1 >
<!--onChange="frmTest.submit();"> -->
Choose from the combo:
select name="lstTopic" size="1">
<%
' while we don't get the end of DataBase
Do While Not objRecordset.EOF
'we put the ID at Value
'this value is important to linked tables
%>
<option VALUE="<%=objRecordset("au_ID")%>">
<!-- This is what will appear in the combo box -->
<%=objRecordset("au_lname")%>
</option>
<%
' Move to the next record...
objRecordset.MoveNext
Loop ' keep the loop
%>
</SELECT>
</FORM>
</BODY>
</HTML>
<%
' close the recordset object
objRecordset.Close

' clean the Recordset object
Set objRecordset = Nothing
%>

<script language="javascript">
<!--
function ChangeSelect(which)
{
var wOne = which

document.sel.chgsel.value = wOne;
}
//-->
</script>
</HEAD>

<form name="sel">
<select name="lect" OnChange="ChangeSelect(this.value);">
<option value="111">111</option>
<option value="222">222</option>
<option value="333">333</option>
<option value="444">444</option>
<option value="555">555</option>
</select>
<br><br>
<input type="text" name="chgsel" size="20">
</form>
MSN : vb******@hotmail.com
email : so****@ubizcom.co.kr
http://www.ubizcom.co.kr
---------------------------------------------- From DevSonner

Jul 19 '05 #5

P: n/a
Cheers that works really well, by the way, a quick question, can one use
javascript and VBScript on the same page???
"掏團熱" <so****@ubizcom.co.kr> wrote in message
news:c0**********@news1.kornet.net...

"rikesh" <ri**********@website.com> wrote in message
news:u8**************@TK2MSFTNGP09.phx.gbl...
Hi

I'm sure this is a very trivial problem!
I have a combo bound to a recordset. I was wondering how I can show the
value on the page, what the user has selected?
The code that I'm using is below.
Any help, would be much apprceciated.

Kind regards

--
Kind Regards

Rikesh
(V.InterDev6.0-SP5/W2K-SP4/SQL2K-SP3)

<%

Dim objConnection 'The connection object
Dim objRecordset 'The recordset object

' create the Connection object
Set objConnection = Server.CreateObject("ADODB.Connection")
' open the DSN
objConnection.Open "Provider=sqloledb;" & _
"Data Source=DEVSVR;" & _
"Initial Catalog=pubs;" & _
"User Id=sa;" & _
"Password=admin"

' creates the recordset object
Set objRecordset = Server.CreateObject("ADODB.Recordset")

' SQL String for query
Dim strSQL
strSQL = "SELECT au_id, au_lname FROM Authors"

' execute the SQL statement that you want
' The query should return all the data you'll
' need in your combo box
objRecordset.Open strSQL, objConnection

Request.Form("au_lname")
Response.Write (Request.Form("au_lname"))

%>
<HTML>
<BODY>
<FORM ACTION="DBCombo.asp" METHOD=POST>
<select name=cboPrimary size=1 >
<!--onChange="frmTest.submit();"> -->
Choose from the combo:
select name="lstTopic" size="1">
<%
' while we don't get the end of DataBase
Do While Not objRecordset.EOF
'we put the ID at Value
'this value is important to linked tables
%>
<option VALUE="<%=objRecordset("au_ID")%>">
<!-- This is what will appear in the combo box -->
<%=objRecordset("au_lname")%>
</option>
<%
' Move to the next record...
objRecordset.MoveNext
Loop ' keep the loop
%>
</SELECT>
</FORM>
</BODY>
</HTML>
<%
' close the recordset object
objRecordset.Close

' clean the Recordset object
Set objRecordset = Nothing
%>

<script language="javascript">
<!--
function ChangeSelect(which)
{
var wOne = which

document.sel.chgsel.value = wOne;
}
//-->
</script>
</HEAD>

<form name="sel">
<select name="lect" OnChange="ChangeSelect(this.value);">
<option value="111">111</option>
<option value="222">222</option>
<option value="333">333</option>
<option value="444">444</option>
<option value="555">555</option>
</select>
<br><br>
<input type="text" name="chgsel" size="20">
</form>
MSN : vb******@hotmail.com
email : so****@ubizcom.co.kr
http://www.ubizcom.co.kr
---------------------------------------------- From DevSonner

Jul 19 '05 #6

P: n/a
<script language="javascript">

<script language="vbscript">
??
"rikesh" <ri**********@website.com> wrote in message
news:e1**************@TK2MSFTNGP09.phx.gbl...
Cheers that works really well, by the way, a quick question, can one use
javascript and VBScript on the same page???
"掏團熱" <so****@ubizcom.co.kr> wrote in message
news:c0**********@news1.kornet.net...

"rikesh" <ri**********@website.com> wrote in message
news:u8**************@TK2MSFTNGP09.phx.gbl...
Hi

I'm sure this is a very trivial problem!
I have a combo bound to a recordset. I was wondering how I can show the value on the page, what the user has selected?
The code that I'm using is below.
Any help, would be much apprceciated.

Kind regards

--
Kind Regards

Rikesh
(V.InterDev6.0-SP5/W2K-SP4/SQL2K-SP3)

<%

Dim objConnection 'The connection object
Dim objRecordset 'The recordset object

' create the Connection object
Set objConnection = Server.CreateObject("ADODB.Connection")
' open the DSN
objConnection.Open "Provider=sqloledb;" & _
"Data Source=DEVSVR;" & _
"Initial Catalog=pubs;" & _
"User Id=sa;" & _
"Password=admin"

' creates the recordset object
Set objRecordset = Server.CreateObject("ADODB.Recordset")

' SQL String for query
Dim strSQL
strSQL = "SELECT au_id, au_lname FROM Authors"

' execute the SQL statement that you want
' The query should return all the data you'll
' need in your combo box
objRecordset.Open strSQL, objConnection

Request.Form("au_lname")
Response.Write (Request.Form("au_lname"))

%>
<HTML>
<BODY>
<FORM ACTION="DBCombo.asp" METHOD=POST>
<select name=cboPrimary size=1 >
<!--onChange="frmTest.submit();"> -->
Choose from the combo:
select name="lstTopic" size="1">
<%
' while we don't get the end of DataBase
Do While Not objRecordset.EOF
'we put the ID at Value
'this value is important to linked tables
%>
<option VALUE="<%=objRecordset("au_ID")%>">
<!-- This is what will appear in the combo box -->
<%=objRecordset("au_lname")%>
</option>
<%
' Move to the next record...
objRecordset.MoveNext
Loop ' keep the loop
%>
</SELECT>
</FORM>
</BODY>
</HTML>
<%
' close the recordset object
objRecordset.Close

' clean the Recordset object
Set objRecordset = Nothing
%>

<script language="javascript">
<!--
function ChangeSelect(which)
{
var wOne = which

document.sel.chgsel.value = wOne;
}
//-->
</script>
</HEAD>

<form name="sel">
<select name="lect" OnChange="ChangeSelect(this.value);">
<option value="111">111</option>
<option value="222">222</option>
<option value="333">333</option>
<option value="444">444</option>
<option value="555">555</option>
</select>
<br><br>
<input type="text" name="chgsel" size="20">
</form>
MSN : vb******@hotmail.com
email : so****@ubizcom.co.kr
http://www.ubizcom.co.kr
---------------------------------------------- From DevSonner



Jul 19 '05 #7

P: n/a
hate to soudn like one of those people who always corrects others, but it's
not a combo. Call it a select, or a dropdown, or whatever you want. But
there is no such thing as a combo on web products.
Jul 19 '05 #8

P: n/a
I'll bear that in mind in the future!!! Cheers! ;-)

"middletree" <mi********@htomail.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
hate to soudn like one of those people who always corrects others, but it's not a combo. Call it a select, or a dropdown, or whatever you want. But
there is no such thing as a combo on web products.

Jul 19 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.