Select option pulldown menu and request.form problem

Discussion in 'ASP General' started by .Net Sports, Oct 26, 2009.

  1. .Net Sports

    .Net Sports Guest

    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
    .Net Sports, Oct 26, 2009
    #1
    1. Advertising

  2. .Net Sports

    Dan Guest

    ".Net Sports" <> wrote in message
    news:...
    > 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



    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
    Dan, Oct 27, 2009
    #2
    1. Advertising

  3. .Net Sports

    Evertjan. Guest

    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)
    Evertjan., Oct 27, 2009
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Neil Marshall

    Writing a pulldown menu tutorial

    Neil Marshall, Feb 18, 2004, in forum: HTML
    Replies:
    0
    Views:
    359
    Neil Marshall
    Feb 18, 2004
  2. Xeno Campanoli
    Replies:
    0
    Views:
    95
    Xeno Campanoli
    Sep 10, 2005
  3. cgplays.com
    Replies:
    1
    Views:
    101
    Pachydermitis
    Aug 16, 2003
  4. Oskar Wild
    Replies:
    2
    Views:
    154
    Oskar Wild
    Aug 28, 2003
  5. R.G. Vervoort
    Replies:
    3
    Views:
    95
    Thomas 'PointedEars' Lahn
    Apr 27, 2004
Loading...

Share This Page