473,396 Members | 1,998 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Another Drop List question

I've got another drop list problem

I am using the following code where users select a name, but it should
pass a name and email into the table

<select name="user">
<option value="<% Response.Write (rsUser("Name")) %>">
<% Response.Write (rsUser("Name")) %>
<input type="hidden" name="Email" value="<% Response.Write
(rsUser("Email")) %>">
</option>
</select>
everything seems to be ok when i test the form as the source it produces
is this:

<select name="user">
<option value="1st guy">
1st guy
<input type="hidden" name="Email" value="1s*****@domain.com">
</option>

<option value="2nd guy">
2nd guy
<input type="hidden" name="Email" value="2n*****@domain.com">
</option>
</select>

so everything seems fine, it is pulling the information from the 1st
table just fine, but when i submit to add the information to the 2nd
table it does not add the email value, i get the following error

Microsoft JET Database Engine (0x80004005)
Field 'Table.Email' cannot be a zero-length string.

if i change the email field in the table to allow zero length i don't
get the error, but the email does not go into the table, just the name
is added (it's an access 2000 database)

any ideas what i am doing wrong here?

thanks
Jul 22 '05 #1
15 2132
C White wrote:
<snip>> if i change the email field in the table to allow zero length i
don't
get the error, but the email does not go into the table, just the name
is added (it's an access 2000 database)

any ideas what i am doing wrong here?

Impossible to say without seeing the code used to add the data to the
database

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 22 '05 #2
Sorry bout that, I wasn't sure if anyone would want it, here it is:

<%

'declare your variables
Dim Name, Email
Dim sConnString, connection, sSQL

' Receiving values from Form, assign the values entered to variables
Name = Request.Form("Name")
Email = Request.Form("Email")

'declare SQL statement that will query the database
sSQL = "INSERT into users (Name, Email) values ('" & Name & "', '" &
Email & "')"

'define the connection string, specify database
'driver and the location of database
sConnString="PROVIDER=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & Server.MapPath("User_Info.mdb")
'create an ADO connection object
Set connection = Server.CreateObject("ADODB.Connection")

'Open the connection to the database
connection.Open(sConnString)

'execute the SQL
connection.execute(sSQL)

response.write "The agent information was successfully submitted."

' Done. Close the connection object
connection.Close
Set connection = Nothing
%>

Bob Barrows [MVP] wrote:
C White wrote:
<snip>> if i change the email field in the table to allow zero length i
don't
get the error, but the email does not go into the table, just the name
is added (it's an access 2000 database)

any ideas what i am doing wrong here?


Impossible to say without seeing the code used to add the data to the
database

Jul 22 '05 #3
"C White" wrote in message news:6c********************@rogers.com...
: I've got another drop list problem
:
: I am using the following code where users select a name, but it should
: pass a name and email into the table
:
: <select name="user">
: <option value="<% Response.Write (rsUser("Name")) %>">
: <% Response.Write (rsUser("Name")) %>
: <input type="hidden" name="Email" value="<% Response.Write
: (rsUser("Email")) %>">
: </option>
: </select>
: everything seems to be ok when i test the form as the source it produces
: is this:
:
: <select name="user">
: <option value="1st guy">
: 1st guy
: <input type="hidden" name="Email" value="1s*****@domain.com">
: </option>
:
: <option value="2nd guy">
: 2nd guy
: <input type="hidden" name="Email" value="2n*****@domain.com">
: </option>
: </select>
:
: so everything seems fine, it is pulling the information from the 1st
: table just fine, but when i submit to add the information to the 2nd
: table it does not add the email value, i get the following error
:
: Microsoft JET Database Engine (0x80004005)
: Field 'Table.Email' cannot be a zero-length string.
:
: if i change the email field in the table to allow zero length i don't
: get the error, but the email does not go into the table, just the name
: is added (it's an access 2000 database)
:
: any ideas what i am doing wrong here?

Two things:

1. If your database field is set to not allow zero-length strings, then it
needs data. This is not the code where you insert the data, it is the code
where you are showing values you have received from the data. Have you
verified the data is not present in the database? Are you getting an error
when you insert data or do you have an On Error Resume Next line in your
insert code?

2. I have found it is often easier and possibly less of a performance hit if
you put your HTML in strings and then pass them through a routine to write
it to the page.

Ex.

<%@ Language=VBScript %>
<%
..
..
..

sub prt(str)
Response.Write(str & vbCrLf)
end sub

dim s
s = "<select name=""user"">" & vbCrLf & _
"<option value=""" & rsUser("Name") & """>" & rsUser("Name") & vbCrLf & _
"<input type=""hidden"" name=""Email"" value=""" & rsUser("Email") & """>"
& vbCrLf & _
"</option>" & vbCrLf & _
"</select>"

prt s

%>

I like this better because my server is not switching back and forth to read
ASP code and HTML and for me, it makes it easier to line up my quotes. I
know that my string needs quotes and if I assign a value to an HTML element
that I need 3, otherwise, adding quotes for HTML means I need 2. So, single
around the edges, 2 for all HTML values and 3 if I need to pass a value from
ASP.

This:
& vbCrLf

....adds a carriage return, line feed to the HTML output so the code is more
legible. It has nothing to do with how the code runs.

& _ could probably be shortened to just _ which is a concatentation
character so VBScript code can resume on the next line.

I'm building a string that gets passed once and my parser reads the whole
page, rather than switching back and forth to read ASP, HTML, ASP, etc. I
am told this is how the parser works. I could redefine "s" as above, or I
could even have an array of statements, but it gives me better control over
the output of my data.

instead of ...

<%@ Language=VBScript %>
<%
..
..
..
%>
<select name="user">
<option value="<% Response.Write (rsUser("Name")) %>">
<% Response.Write (rsUser("Name")) %>
<input type="hidden" name="Email" value="<% Response.Write
(rsUser("Email")) %>">
</option>
</select>
<%
....
%>

....at the very least you could replace the Response.Writes with =

<select name="user">
<option value="<% = rsUser("Name") %>">
<% = rsUser("Name") %>
<input type="hidden" name="Email" value="<% = rsUser("Email") %>">
</option>
</select>

HTH...

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
Jul 22 '05 #4
C White wrote:
Sorry bout that, I wasn't sure if anyone would want it, here it is:

<%

'declare your variables
Dim Name, Email
Dim sConnString, connection, sSQL

' Receiving values from Form, assign the values entered to variables
Name = Request.Form("Name")
Email = Request.Form("Email")
You need validation code here to ensure these variables contain what you
expect. Use the len() function to verify that they contain data.
'declare SQL statement that will query the database
sSQL = "INSERT into users (Name, Email) values ('" & Name & "', '" &
Email & "')"

Since you are having a possible sql problem, you need to use basic debugging
to make sure the sql statement contains what you expect:

Response.Write sSQL
Response.End

You can comment out the above lines when finished debugging. We need to see
the resulting statement from the browser window. When using concatenation to
create a dynamic sql statement, your goal is to create a statement that will
run as-is in your database's query execution tool (the Access Query Builder)
connection.Open(sConnString)
Parentheses are not needed
http://blogs.msdn.com/ericlippert/ar.../15/52996.aspx

'execute the SQL
connection.execute(sSQL)


Tell ADO what the command type is (adCmdText = 1) and that you are not
expecting any records back so it does not waste time and resources behind
the scenes creating a recordset to receive the resultset (adExecuteNoRecords
= 128)

connection.execute sSQL,,129 '1 + 128 = 129
Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 22 '05 #5
"C White" wrote in message news:Vv********************@rogers.com...
: Sorry bout that, I wasn't sure if anyone would want it, here it is:
:
: <%
:
: 'declare your variables
: Dim Name, Email
: Dim sConnString, connection, sSQL
:
: ' Receiving values from Form, assign the values entered to variables
: Name = Request.Form("Name")
: Email = Request.Form("Email")
:
: 'declare SQL statement that will query the database
: sSQL = "INSERT into users (Name, Email) values ('" & Name & "', '" &
: Email & "')"
:
: 'define the connection string, specify database
: 'driver and the location of database
: sConnString="PROVIDER=Microsoft.Jet.OLEDB.4.0;" & _
: "Data Source=" & Server.MapPath("User_Info.mdb")
:
:
: 'create an ADO connection object
: Set connection = Server.CreateObject("ADODB.Connection")
:
: 'Open the connection to the database
: connection.Open(sConnString)
:
: 'execute the SQL
: connection.execute(sSQL)
:
: response.write "The agent information was successfully submitted."
:
: ' Done. Close the connection object
: connection.Close
: Set connection = Nothing
: %>

Where do you verify that the form fields have values? Is that done on the
client side?

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
Jul 22 '05 #6
Roland Hall wrote:
"C White" wrote in message news:6c********************@rogers.com...
: I've got another drop list problem
:
: I am using the following code where users select a name, but it should
: pass a name and email into the table
:
: <select name="user">
: <option value="<% Response.Write (rsUser("Name")) %>">
: <% Response.Write (rsUser("Name")) %>
: <input type="hidden" name="Email" value="<% Response.Write
: (rsUser("Email")) %>">
: </option>
: </select>
: everything seems to be ok when i test the form as the source it produces
: is this:
:
: <select name="user">
: <option value="1st guy">
: 1st guy
: <input type="hidden" name="Email" value="1s*****@domain.com">
: </option>
:
: <option value="2nd guy">
: 2nd guy
: <input type="hidden" name="Email" value="2n*****@domain.com">
: </option>
: </select>
:
: so everything seems fine, it is pulling the information from the 1st
: table just fine, but when i submit to add the information to the 2nd
: table it does not add the email value, i get the following error
:
: Microsoft JET Database Engine (0x80004005)
: Field 'Table.Email' cannot be a zero-length string.
:
: if i change the email field in the table to allow zero length i don't
: get the error, but the email does not go into the table, just the name
: is added (it's an access 2000 database)
:
: any ideas what i am doing wrong here?

Two things:

1. If your database field is set to not allow zero-length strings, then it
needs data. This is not the code where you insert the data, it is the code
where you are showing values you have received from the data. Have you
verified the data is not present in the database? Are you getting an error
when you insert data or do you have an On Error Resume Next line in your
insert code?

2. I have found it is often easier and possibly less of a performance hit if
you put your HTML in strings and then pass them through a routine to write
it to the page.

Ex.

<%@ Language=VBScript %>
<%
.
.
.

sub prt(str)
Response.Write(str & vbCrLf)
end sub

dim s
s = "<select name=""user"">" & vbCrLf & _
"<option value=""" & rsUser("Name") & """>" & rsUser("Name") & vbCrLf & _
"<input type=""hidden"" name=""Email"" value=""" & rsUser("Email") & """>"
& vbCrLf & _
"</option>" & vbCrLf & _
"</select>"

prt s

%>

I like this better because my server is not switching back and forth to read
ASP code and HTML and for me, it makes it easier to line up my quotes. I
know that my string needs quotes and if I assign a value to an HTML element
that I need 3, otherwise, adding quotes for HTML means I need 2. So, single
around the edges, 2 for all HTML values and 3 if I need to pass a value from
ASP.

This:
& vbCrLf

...adds a carriage return, line feed to the HTML output so the code is more
legible. It has nothing to do with how the code runs.

& _ could probably be shortened to just _ which is a concatentation
character so VBScript code can resume on the next line.

I'm building a string that gets passed once and my parser reads the whole
page, rather than switching back and forth to read ASP, HTML, ASP, etc. I
am told this is how the parser works. I could redefine "s" as above, or I
could even have an array of statements, but it gives me better control over
the output of my data.

instead of ...

<%@ Language=VBScript %>
<%
.
.
.
%>
<select name="user">
<option value="<% Response.Write (rsUser("Name")) %>">
<% Response.Write (rsUser("Name")) %>
<input type="hidden" name="Email" value="<% Response.Write
(rsUser("Email")) %>">
</option>
</select>
<%
...
%>

...at the very least you could replace the Response.Writes with =

<select name="user">
<option value="<% = rsUser("Name") %>">
<% = rsUser("Name") %>
<input type="hidden" name="Email" value="<% = rsUser("Email") %>">
</option>
</select>

HTH...

HI

1. I checked the database, it's not inserting the email value

2. You've given me a lot of examples and explanations to read, thank you
very much, these will help and i'll let you know if this helps.
Jul 22 '05 #7
Bob Barrows [MVP] wrote:
C White wrote:
Sorry bout that, I wasn't sure if anyone would want it, here it is:

<%

'declare your variables
Dim Name, Email
Dim sConnString, connection, sSQL

' Receiving values from Form, assign the values entered to variables
Name = Request.Form("Name")
Email = Request.Form("Email")

You need validation code here to ensure these variables contain what you
expect. Use the len() function to verify that they contain data.
'declare SQL statement that will query the database
sSQL = "INSERT into users (Name, Email) values ('" & Name & "', '" &
Email & "')"

Since you are having a possible sql problem, you need to use basic debugging
to make sure the sql statement contains what you expect:

Response.Write sSQL
Response.End

You can comment out the above lines when finished debugging. We need to see
the resulting statement from the browser window. When using concatenation to
create a dynamic sql statement, your goal is to create a statement that will
run as-is in your database's query execution tool (the Access Query Builder)

connection.Open(sConnString)

Parentheses are not needed
http://blogs.msdn.com/ericlippert/ar.../15/52996.aspx

'execute the SQL
connection.execute(sSQL)

Tell ADO what the command type is (adCmdText = 1) and that you are not
expecting any records back so it does not waste time and resources behind
the scenes creating a recordset to receive the resultset (adExecuteNoRecords
= 128)

connection.execute sSQL,,129 '1 + 128 = 129
Bob Barrows


the debugging code shows me the following, (when i set the database to
allow zero length)

INSERT into Users (Name, Email) values ('1st guy', '')

if i move the hidden email field outside of my select code and just set
it to

<input type="hidden" name="TL_Email" value="em***@domain.com">

everything works fine and it inserts the email, so this leeds me to
beleive that there is indeed somethig wrong with the code I am using to
create the drop box and that I should look at another way of doing it

here is the full code i am using to generate the drop list

<select name="Name">
<%
'Dimension variables
Dim adoConName 'Holds the Database Connection Object
Dim rsName 'Holds the recordset for the records in the database
Dim strSQLName 'Holds the SQL query for the database

'Create an ADO connection object
Set adoConName = Server.CreateObject("ADODB.Connection")

'Set an active connection to the Connection object using a DSN-less
connection
adoConName.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &
Server.MapPath("User_Info.mdb")

'Set an active connection to the Connection object using DSN connection
'adoCon.Open "DSN=guestbook"

'Create an ADO recordset object
Set rsName = Server.CreateObject("ADODB.Recordset")

'Initialise the strSQL variable with an SQL statement to query the database
strSQLName = "SELECT * FROM Names ORDER by Name ASC;"

'Open the recordset with the SQL query
rsName.Open strSQLName, adoConName

'Loop through the recordset
Do While not rsName.EOF
%>
<option value="<% Response.Write (rsName("Name")) %>">
<% Response.Write (rsName("Name")) %>
</option>
<input type="hidden" name="Email" value="<% Response.Write
(rsName("Email")) %>">
<%
'Move to the next record in the recordset
rsName.MoveNext

Loop

'Reset server objects
rsName.Close
Set rsName = Nothing
Set adoConName = Nothing
%>
</select>

if anyone has suggestions please submit them, in the meantime i will
re-evaluate how i am generating the drop box
Jul 22 '05 #8
Bob Barrows [MVP] wrote:
C White wrote:
Sorry bout that, I wasn't sure if anyone would want it, here it is:

<%

'declare your variables
Dim Name, Email
Dim sConnString, connection, sSQL

' Receiving values from Form, assign the values entered to variables
Name = Request.Form("Name")
Email = Request.Form("Email")

You need validation code here to ensure these variables contain what you
expect. Use the len() function to verify that they contain data.
'declare SQL statement that will query the database
sSQL = "INSERT into users (Name, Email) values ('" & Name & "', '" &
Email & "')"

Since you are having a possible sql problem, you need to use basic debugging
to make sure the sql statement contains what you expect:

Response.Write sSQL
Response.End

You can comment out the above lines when finished debugging. We need to see
the resulting statement from the browser window. When using concatenation to
create a dynamic sql statement, your goal is to create a statement that will
run as-is in your database's query execution tool (the Access Query Builder)

connection.Open(sConnString)

Parentheses are not needed
http://blogs.msdn.com/ericlippert/ar.../15/52996.aspx

'execute the SQL
connection.execute(sSQL)

Tell ADO what the command type is (adCmdText = 1) and that you are not
expecting any records back so it does not waste time and resources behind
the scenes creating a recordset to receive the resultset (adExecuteNoRecords
= 128)

connection.execute sSQL,,129 '1 + 128 = 129
Bob Barrows

the debugging code shows me the following, (when i set the database to
allow zero length)

INSERT into Users (Name, Email) values ('1st guy', '')

if i move the hidden email field outside of my select code and just set
it to

<input type="hidden" name="TL_Email" value="em***@domain.com">

everything works fine and it inserts the email, so this leeds me to
beleive that there is indeed somethig wrong with the code I am using to
create the drop box and that I should look at another way of doing it

here is the full code i am using to generate the drop list

<select name="Name">
<%
'Dimension variables
Dim adoConName 'Holds the Database Connection Object
Dim rsName 'Holds the recordset for the records in the database
Dim strSQLName 'Holds the SQL query for the database

'Create an ADO connection object
Set adoConName = Server.CreateObject("ADODB.Connection")

'Set an active connection to the Connection object using a DSN-less
connection
adoConName.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &
Server.MapPath("User_Info.mdb")

'Set an active connection to the Connection object using DSN connection
'adoCon.Open "DSN=guestbook"

'Create an ADO recordset object
Set rsName = Server.CreateObject("ADODB.Recordset")

'Initialise the strSQL variable with an SQL statement to query the database
strSQLName = "SELECT * FROM Names ORDER by Name ASC;"

'Open the recordset with the SQL query
rsName.Open strSQLName, adoConName

'Loop through the recordset
Do While not rsName.EOF
%>
<option value="<% Response.Write (rsName("Name")) %>">
<% Response.Write (rsName("Name")) %>
</option>
<input type="hidden" name="Email" value="<% Response.Write
(rsName("Email")) %>">
<%
'Move to the next record in the recordset
rsName.MoveNext

Loop

'Reset server objects
rsName.Close
Set rsName = Nothing
Set adoConName = Nothing
%>
</select>

if anyone has suggestions please submit them, in the meantime i will
re-evaluate how i am generating the drop box
Jul 22 '05 #9
"C White" wrote in message news:Ru********************@rogers.com...
: Bob Barrows [MVP] wrote:
:
: > C White wrote:
: >
: >>Sorry bout that, I wasn't sure if anyone would want it, here it is:
: >>
: >><%
: >>
: >>'declare your variables
: >>Dim Name, Email
: >>Dim sConnString, connection, sSQL
: >>
: >>' Receiving values from Form, assign the values entered to variables
: >>Name = Request.Form("Name")
: >>Email = Request.Form("Email")
: >
: >
: > You need validation code here to ensure these variables contain what you
: > expect. Use the len() function to verify that they contain data.
: >
: >>'declare SQL statement that will query the database
: >>sSQL = "INSERT into users (Name, Email) values ('" & Name & "', '" &
: >>Email & "')"
: >>
: >
: >
: > Since you are having a possible sql problem, you need to use basic
debugging
: > to make sure the sql statement contains what you expect:
: >
: > Response.Write sSQL
: > Response.End
: >
: > You can comment out the above lines when finished debugging. We need to
see
: > the resulting statement from the browser window. When using
concatenation to
: > create a dynamic sql statement, your goal is to create a statement that
will
: > run as-is in your database's query execution tool (the Access Query
Builder)
: >
: >
: >>connection.Open(sConnString)
: >
: >
: > Parentheses are not needed
: > http://blogs.msdn.com/ericlippert/ar.../15/52996.aspx
: >
: >
: >>'execute the SQL
: >>connection.execute(sSQL)
: >
: >
: > Tell ADO what the command type is (adCmdText = 1) and that you are not
: > expecting any records back so it does not waste time and resources
behind
: > the scenes creating a recordset to receive the resultset
(adExecuteNoRecords
: > = 128)
: >
: > connection.execute sSQL,,129 '1 + 128 = 129
: >
: >
: > Bob Barrows
:
: the debugging code shows me the following, (when i set the database to
: allow zero length)
:
: INSERT into Users (Name, Email) values ('1st guy', '')
:
: if i move the hidden email field outside of my select code and just set
: it to
:
: <input type="hidden" name="TL_Email" value="em***@domain.com">
:
: everything works fine and it inserts the email, so this leeds me to
: beleive that there is indeed somethig wrong with the code I am using to
: create the drop box and that I should look at another way of doing it
:
: here is the full code i am using to generate the drop list
:
: <select name="Name">
: <%
: 'Dimension variables
: Dim adoConName 'Holds the Database Connection Object
: Dim rsName 'Holds the recordset for the records in the database
: Dim strSQLName 'Holds the SQL query for the database
:
: 'Create an ADO connection object
: Set adoConName = Server.CreateObject("ADODB.Connection")
:
: 'Set an active connection to the Connection object using a DSN-less
: connection
: adoConName.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &
: Server.MapPath("User_Info.mdb")
:
: 'Set an active connection to the Connection object using DSN connection
: 'adoCon.Open "DSN=guestbook"
:
: 'Create an ADO recordset object
: Set rsName = Server.CreateObject("ADODB.Recordset")
:
: 'Initialise the strSQL variable with an SQL statement to query the
database
: strSQLName = "SELECT * FROM Names ORDER by Name ASC;"
:
: 'Open the recordset with the SQL query
: rsName.Open strSQLName, adoConName
:
: 'Loop through the recordset
: Do While not rsName.EOF
: %>
: <option value="<% Response.Write (rsName("Name")) %>">
: <% Response.Write (rsName("Name")) %>
: </option>
: <input type="hidden" name="Email" value="<% Response.Write
: (rsName("Email")) %>">
: <%
: 'Move to the next record in the recordset
: rsName.MoveNext
:
: Loop
:
: 'Reset server objects
: rsName.Close
: Set rsName = Nothing
: Set adoConName = Nothing
: %>
: </select>
:
: if anyone has suggestions please submit them, in the meantime i will
: re-evaluate how i am generating the drop box

Why is the hidden field inside the select? Are you associating different
email addresses with different names? If so, there are probably numerous
ways you could do that but one would be to have a hidden email list, not
just a hidden field and when posting your form, the index into the select
provides the index into your hidden list of email addresses and then
populates a hidden field in your form, outside of the select before
submitting. This way when the form is posted, the selected index provides
the name and the other [hidden or not hidden] element in the form for the
email address. Otherwise it appears all of your email addresses posted will
be blank.

I'm surprised that you do not get an error in your insert if the field is
set to require data for a record.

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
Jul 22 '05 #10
to answer your question

i have a table that looks as follows:

name email
1st guy 1s****@domain.com
2nd guy 2n****@domain.com

i just want the drop list to show

1st guy
2nd guy

but it needs to pass both the name and email into the new table, which
is why i put the email into a hidden field, i should probably state that
i am just beginning to learn asp and every now and then i come up with
problems like this to help myself learn, as for why did i put the email
into a hidden field in the select form, i don't know any better, i
thought this would be the best way to to it, but i have learned that it
is not so i am still looking at different ways to accomplish this

i thank you for your suggestion as it gives me another idea/way to
approach this problem, hopefully i'll figure it out sooner than later :)

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 22 '05 #11
"C White" wrote in message news:%2****************@TK2MSFTNGP10.phx.gbl...
: to answer your question
:
: i have a table that looks as follows:
:
: name email
: 1st guy 1s****@domain.com
: 2nd guy 2n****@domain.com
:
: i just want the drop list to show
:
: 1st guy
: 2nd guy
:
: but it needs to pass both the name and email into the new table, which
: is why i put the email into a hidden field, i should probably state that
: i am just beginning to learn asp and every now and then i come up with
: problems like this to help myself learn, as for why did i put the email
: into a hidden field in the select form, i don't know any better, i
: thought this would be the best way to to it, but i have learned that it
: is not so i am still looking at different ways to accomplish this

It's not a problem to have the email address in the hidden field but you
have the hidden field in the middle of a select. It's not working is it?

You have this:

<form...>
<select ...>
<option...>
<option...>
<input type="hidden"... />
</select>
</form>

I think it needs to be this:

<form...>
<select ...>
<option...>
<option...>
</select>
<select style="display: none" ...>
<option...>
<option...>
</select>
</form>

Proof of concept:
http://kiddanger.com/lab/selecthidden1.asp

Here is the code for the file it posts to:

<%@ Language=VBScript %>
<%
Option Explicit
Response.Buffer = True

dim eName, eMail
eName = Replace(Request.Form("Name"),"'","''")
eMail = Replace(Request.Form("Email"),"'","''")

Response.Write "Name: " & eName & "<br />" & vbCrLf
Response.Write "Email: " & eMail & vbCrLf
%>

HTH...

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
Jul 22 '05 #12
Roland Hall wrote:
"C White" wrote in message news:%2****************@TK2MSFTNGP10.phx.gbl...
: to answer your question
:
: i have a table that looks as follows:
:
: name email
: 1st guy 1s****@domain.com
: 2nd guy 2n****@domain.com
:
: i just want the drop list to show
:
: 1st guy
: 2nd guy
:
: but it needs to pass both the name and email into the new table, which
: is why i put the email into a hidden field, i should probably state that
: i am just beginning to learn asp and every now and then i come up with
: problems like this to help myself learn, as for why did i put the email
: into a hidden field in the select form, i don't know any better, i
: thought this would be the best way to to it, but i have learned that it
: is not so i am still looking at different ways to accomplish this

It's not a problem to have the email address in the hidden field but you
have the hidden field in the middle of a select. It's not working is it?

You have this:

<form...>
<select ...>
<option...>
<option...>
<input type="hidden"... />
</select>
</form>

I think it needs to be this:

<form...>
<select ...>
<option...>
<option...>
</select>
<select style="display: none" ...>
<option...>
<option...>
</select>
</form>

Proof of concept:
http://kiddanger.com/lab/selecthidden1.asp

Here is the code for the file it posts to:

<%@ Language=VBScript %>
<%
Option Explicit
Response.Buffer = True

dim eName, eMail
eName = Replace(Request.Form("Name"),"'","''")
eMail = Replace(Request.Form("Email"),"'","''")

Response.Write "Name: " & eName & "<br />" & vbCrLf
Response.Write "Email: " & eMail & vbCrLf
%>

HTH...


that's great, how did you find that? I've been searching for some time
now and i came up with nothing, which is why i had to post to being with
Jul 22 '05 #13
"C White" wrote in message news:Bs********************@rogers.com...
: Roland Hall wrote:
: > "C White" wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
: > : to answer your question
: > :
: > : i have a table that looks as follows:
: > :
: > : name email
: > : 1st guy 1s****@domain.com
: > : 2nd guy 2n****@domain.com
: > :
: > : i just want the drop list to show
: > :
: > : 1st guy
: > : 2nd guy
: > :
: > : but it needs to pass both the name and email into the new table, which
: > : is why i put the email into a hidden field, i should probably state
that
: > : i am just beginning to learn asp and every now and then i come up with
: > : problems like this to help myself learn, as for why did i put the
email
: > : into a hidden field in the select form, i don't know any better, i
: > : thought this would be the best way to to it, but i have learned that
it
: > : is not so i am still looking at different ways to accomplish this
: >
: > It's not a problem to have the email address in the hidden field but you
: > have the hidden field in the middle of a select. It's not working is
it?
: >
: > You have this:
: >
: > <form...>
: > <select ...>
: > <option...>
: > <option...>
: > <input type="hidden"... />
: > </select>
: > </form>
: >
: > I think it needs to be this:
: >
: > <form...>
: > <select ...>
: > <option...>
: > <option...>
: > </select>
: > <select style="display: none" ...>
: > <option...>
: > <option...>
: > </select>
: > </form>
: >
: > Proof of concept:
: > http://kiddanger.com/lab/selecthidden1.asp
: >
: > Here is the code for the file it posts to:
: >
: > <%@ Language=VBScript %>
: > <%
: > Option Explicit
: > Response.Buffer = True
: >
: > dim eName, eMail
: > eName = Replace(Request.Form("Name"),"'","''")
: > eMail = Replace(Request.Form("Email"),"'","''")
: >
: > Response.Write "Name: " & eName & "<br />" & vbCrLf
: > Response.Write "Email: " & eMail & vbCrLf
: > %>
: >
: > HTH...
: >
:
: that's great, how did you find that? I've been searching for some time
: now and i came up with nothing, which is why i had to post to being with

When you spend your time in one area of development, you tend to overlook
some things you have not worked on in awhile. Had I been working more with
list boxes, I would have probably noticed it right away. I completely
overlooked it the first time.

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
Jul 22 '05 #14
It worked!!!!!

Thanks for the explanations and examples!!!!

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 22 '05 #15
"C White" wrote in message news:%2******************@TK2MSFTNGP10.phx.gbl...
: It worked!!!!!
:
: Thanks for the explanations and examples!!!!

You're welcome. (O:=

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
Jul 22 '05 #16

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: jonnytansey2 | last post by:
Can anyone out there give me a pointer regarding creating a dynamically-generated drop-down list connected to an array? And is that question as clear as chocolate spread? Here's what I've got....
4
by: cwhite | last post by:
Hi I have another drop list question. I have a table like this: computer dell computer ibm computer hp
2
by: kmnotes04 | last post by:
Is it possible to link one drop-down box to another? For example, if a name is chosen from a drop-down list, can another drop-down list then automatically display the person's office as a result of...
2
by: ramesh | last post by:
hi, I am using Com+ in my application. It will have InsertRecords,selectRecords,updateRecords function. In the Web Form i have Drop-down list. I want to select records from SQL and add it to this...
13
by: Leszek Taratuta | last post by:
Hello, I have several drop-down lists on my ASP.NET page. I need to keep data sources of these lists in Session State. What would be the most effective method to serialize this kind of data...
1
by: student2008 | last post by:
Sorry about the title its a tricky one. I have a form which allows me to add a question and answers into a mysql database via a combination of, if a certain option is chosen and the reset button...
3
kcdoell
by: kcdoell | last post by:
I have 5 cascading combo boxes on a form. Below is a sample of my vb in the first combo box: Private Sub CboDivision_AfterUpdate() 'When the Division is selected, the appropriate Segment...
3
by: jcassan | last post by:
Hello folks. I am new to these forums and have something, which has been stumping me for little while. I am using pspell to spellcheck a scrolling textbox (textarea) containing user input. I...
14
by: mjvm | last post by:
HI, I have had a search for the answer to this question, but I can't transfer what I am reading to my database. I don't know enough about the language required, but have been able to get my...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.