Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Select option pulldown menu and request.form problem

8 views
Skip to first unread message

.Net Sports

unread,
Oct 26, 2009, 4:57:20 PM10/26/09
to
I have a select pulldown html menu that takes values from a database,
and then send it to the next page via form action = post for
processing. I have assigned the select box name Category, and when it
goes to the next page, if a category name has a space in it, it will
truncate the category name after the first space. I'm using
Server.URLencode to try and keep the string intact, but the category
name still gets truncated:

'''how i am labeling my select pulldown, with the data for the option
value:
<select name=Category>
response.write "<option value=" & RSCATEGORY("catname") & ">" &
RSCATEGORY("catname") & "</option>"

'''how I am calling the category name on the next page
RSEVENTS("category") = Server.URLencode(request.form("Category"))

TIA for help
NS

Dan

unread,
Oct 27, 2009, 6:05:52 AM10/27/09
to

".Net Sports" <ballz...@cox.net> wrote in message
news:ff737306-c1a6-48cb...@k13g2000prh.googlegroups.com...


You need to put the category name inside quotes, either single or double, as
it's the browser that is truncating the category name if there is a space
inside it as without quoting it has to assume that anything after the space
is starting a new attribute.

<select name=Category>
<%


response.write "<option value=""" & RSCATEGORY("catname") & """>" &
RSCATEGORY("catname") & "</option>"

%>

Note that I've added "" before the closing " in the first string part, and
after the opening " for the second string part. Doubling up double quotes
inside a string represents a single literal double quote within the string.

--

Dan

Evertjan.

unread,
Oct 27, 2009, 6:26:37 AM10/27/09
to
Dan wrote on 27 okt 2009 in microsoft.public.inetserver.asp.general:

> <select name=Category>
> <%
> response.write "<option value=""" & RSCATEGORY("catname") & """>" &
> RSCATEGORY("catname") & "</option>"
> %>

<%
response.write "<option value='" & RSCATEGORY("catname") & "'>" &_


RSCATEGORY("catname") & "</option>"
%>



> Note that I've added "" before the closing " in the first string part,
> and after the opening " for the second string part. Doubling up double
> quotes inside a string represents a single literal double quote within
> the string.

Much easier way to visualize mistakes:

<select name='Category'>

<option value = '<% = RSCATEGORY("catname") %>' >
<% = RSCATEGORY("catname") %></option>

</select>


--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

0 new messages