How to pass a code of a list box to a processing form

Discussion in 'ASP General' started by Jack, Mar 1, 2006.

  1. Jack

    Jack Guest

    Hi,
    I have a asp form where one element is a list box which lists four years
    starting from 2004. This list is drawn from a database table which has YearID
    and Year as two fields as shown below:
    YearID YEAR
    1 2004
    2 2005
    3 2006
    4 2007
    PART OF ASP CODE IS:

    <tr>
    <td width="74%" align ="center" height="18"><font face="Times New Roman"
    size="3" color = "red">YEAR</font></td>
    <td>
    <SELECT NAME="lstYear" SIZE="1">

    <% Do while not RS_Year.EOF
    Response.Write "<Option Value='" & RS_Year("YEAR")& "'>"
    Response.Write RS_Year("YEAR") & "</OPTION>"
    RS_Year.MoveNext
    Loop
    %>
    <td>
    <tr>

    Now I want to capture the value of the YearCode instead of the Year field
    and store the year code value in the processing form to process in a sql
    statement.

    i.e. I am planning to use the Request.Form("lstYear") to capture the value
    of the year code. However, Request.Form("listYear") is showing no value.
    I would appreciate any help or any article link for handling this problem.
    Thank in advance.
    Jack, Mar 1, 2006
    #1
    1. Advertising

  2. Jack wrote:
    > Hi,
    > I have a asp form where one element is a list box which lists four
    > years starting from 2004. This list is drawn from a database table
    > which has YearID and Year as two fields as shown below:
    > YearID YEAR
    > 1 2004
    > 2 2005
    > 3 2006
    > 4 2007
    > PART OF ASP CODE IS:
    >
    > <tr>
    > <td width="74%" align ="center" height="18"><font face="Times New
    > Roman" size="3" color = "red">YEAR</font></td>
    > <td>
    > <SELECT NAME="lstYear" SIZE="1">
    >
    > <% Do while not RS_Year.EOF
    > Response.Write "<Option Value='" & RS_Year("YEAR")& "'>"
    > Response.Write RS_Year("YEAR") & "</OPTION>"
    > RS_Year.MoveNext
    > Loop
    > %>
    > <td>
    > <tr>
    >
    > Now I want to capture the value of the YearCode instead of the


    So why are you using RS_Year("YEAR") for the option value? Wouldn't it make
    more sense to change it to:

    Response.Write "<Option Value='" & RS_Year("YEARID")& "'>"


    > Year field and store the year code value in the processing form to
    > process in a sql statement.
    >
    > i.e. I am planning to use the Request.Form("lstYear") to capture the
    > value of the year code. However, Request.Form("listYear") is showing
    > no value.


    At what point in the process? After you submitted form containing the above
    SELECT element?

    Create a small test form that reproduces the problem and post the entire
    code from that SMALL test form.

    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.
    Bob Barrows [MVP], Mar 1, 2006
    #2
    1. Advertising

  3. Jack

    Jack Guest

    Thanks Bob for your help. I am going to do that. However, the reason I am using
    RS_Year("YEAR") for the option value is that I want to display all the YEAR
    values in the the list box on the form. However, instead of Year I need to
    capture the value of the corresponding code of the YEAR. This code goes to
    the sql statement in the processing asp page. Thanks.

    Response.Write "<Option Value='" & RS_Year("YEARID")& "'>"


    "Bob Barrows [MVP]" wrote:

    > Jack wrote:
    > > Hi,
    > > I have a asp form where one element is a list box which lists four
    > > years starting from 2004. This list is drawn from a database table
    > > which has YearID and Year as two fields as shown below:
    > > YearID YEAR
    > > 1 2004
    > > 2 2005
    > > 3 2006
    > > 4 2007
    > > PART OF ASP CODE IS:
    > >
    > > <tr>
    > > <td width="74%" align ="center" height="18"><font face="Times New
    > > Roman" size="3" color = "red">YEAR</font></td>
    > > <td>
    > > <SELECT NAME="lstYear" SIZE="1">
    > >
    > > <% Do while not RS_Year.EOF
    > > Response.Write "<Option Value='" & RS_Year("YEAR")& "'>"
    > > Response.Write RS_Year("YEAR") & "</OPTION>"
    > > RS_Year.MoveNext
    > > Loop
    > > %>
    > > <td>
    > > <tr>
    > >
    > > Now I want to capture the value of the YearCode instead of the

    >
    > So why are you using RS_Year("YEAR") for the option value? Wouldn't it make
    > more sense to change it to:
    >
    > Response.Write "<Option Value='" & RS_Year("YEARID")& "'>"
    >
    >
    > > Year field and store the year code value in the processing form to
    > > process in a sql statement.
    > >
    > > i.e. I am planning to use the Request.Form("lstYear") to capture the
    > > value of the year code. However, Request.Form("listYear") is showing
    > > no value.

    >
    > At what point in the process? After you submitted form containing the above
    > SELECT element?
    >
    > Create a small test form that reproduces the problem and post the entire
    > code from that SMALL test form.
    >
    > --
    > Microsoft MVP -- ASP/ASP.NET
    > Please reply to the newsgroup. The email account listed in my From
    > header is my spam trap, so I don't check it very often. You will get a
    > quicker response by posting to the newsgroup.
    >
    >
    >
    Jack, Mar 2, 2006
    #3
  4. Jack

    Jack Guest

    Well Bob, I just trimmed my code to get a test asp page. Here please note
    that the tblYear has YearId and Year field. I need to display the Year Value,
    yet capture the YearId(ie. the selected one from the list box) in the
    processing form using request object. This YearId will go the sql statement
    in the processing form.This is the main issue to me ie. how to display one
    field in the list box yet capture the corresponding ID from the form in the
    processing asp page using request form object. Hope I could explain well.
    Here is the code for the test page. Thanks. Regards,

    <!-- #include file="connection.asp" -->
    <!-- #include file="adovbs.inc" -->

    <HTML>
    <HEAD>
    <META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
    </HEAD>

    <center>
    <h2>
    <b>
    <font size="5" color="navy">
    TEST
    </font>
    </b>
    </h2>
    </center>

    <BODY>




    <%
    Set RS_Year = Server.CreateObject("ADODB.Recordset")



    strSQL3 = "SELECT YearId, Year FROM tblYear"
    RS_Year.Open strSQL3, conn

    %>
    <form method=POST name="frm_mainentry" action="mainentry_process.asp"
    onSubmit>
    <div align="center">
    <table border = "1" width="80%" height="1" cellspacing = "1">


    <tr>
    <td width="50%" align ="center" height="18"><font face="Times New Roman"
    size="3" color = "red">COUNT TOTAL OFFENSES</font></td>
    <td width="50%" align="center" BGCOLOR="white" height="18"><font
    face="Times New Roman" size="1">
    <input type="text" name="txt_CountTotalOffenses" size="57"
    style="font-family: Times New Roman; font-size: 12pt"></font></td>
    </tr>
    <%'Response.End%>

    <tr>
    <td width="74%" align ="center" height="18"><font face="Times New Roman"
    size="3" color = "red">YEAR</font></td>
    <td>
    <SELECT NAME="lstYear" SIZE="1">

    <% Do while not RS_Year.EOF
    Response.Write "<Option Value='" & RS_Year("YEAR")& "'>"
    Response.Write RS_Year("YEAR") & "</OPTION>"
    RS_Year.MoveNext
    Loop
    %>
    <td>
    <tr>
    <%'Response.End%>

    <tr>
    <td width="100%" align="right" colspan = "2" height="27"><p><input
    type="submit" value="Submit" name="B3"></td>
    </tr>

    </table>
    </div>
    </form>

    </BODY>
    </HTML>



    "Jack" wrote:

    > Thanks Bob for your help. I am going to do that. However, the reason I am using
    > RS_Year("YEAR") for the option value is that I want to display all the YEAR
    > values in the the list box on the form. However, instead of Year I need to
    > capture the value of the corresponding code of the YEAR. This code goes to
    > the sql statement in the processing asp page. Thanks.
    >
    > Response.Write "<Option Value='" & RS_Year("YEARID")& "'>"
    >
    >
    > "Bob Barrows [MVP]" wrote:
    >
    > > Jack wrote:
    > > > Hi,
    > > > I have a asp form where one element is a list box which lists four
    > > > years starting from 2004. This list is drawn from a database table
    > > > which has YearID and Year as two fields as shown below:
    > > > YearID YEAR
    > > > 1 2004
    > > > 2 2005
    > > > 3 2006
    > > > 4 2007
    > > > PART OF ASP CODE IS:
    > > >
    > > > <tr>
    > > > <td width="74%" align ="center" height="18"><font face="Times New
    > > > Roman" size="3" color = "red">YEAR</font></td>
    > > > <td>
    > > > <SELECT NAME="lstYear" SIZE="1">
    > > >
    > > > <% Do while not RS_Year.EOF
    > > > Response.Write "<Option Value='" & RS_Year("YEAR")& "'>"
    > > > Response.Write RS_Year("YEAR") & "</OPTION>"
    > > > RS_Year.MoveNext
    > > > Loop
    > > > %>
    > > > <td>
    > > > <tr>
    > > >
    > > > Now I want to capture the value of the YearCode instead of the

    > >
    > > So why are you using RS_Year("YEAR") for the option value? Wouldn't it make
    > > more sense to change it to:
    > >
    > > Response.Write "<Option Value='" & RS_Year("YEARID")& "'>"
    > >
    > >
    > > > Year field and store the year code value in the processing form to
    > > > process in a sql statement.
    > > >
    > > > i.e. I am planning to use the Request.Form("lstYear") to capture the
    > > > value of the year code. However, Request.Form("listYear") is showing
    > > > no value.

    > >
    > > At what point in the process? After you submitted form containing the above
    > > SELECT element?
    > >
    > > Create a small test form that reproduces the problem and post the entire
    > > code from that SMALL test form.
    > >
    > > --
    > > Microsoft MVP -- ASP/ASP.NET
    > > Please reply to the newsgroup. The email account listed in my From
    > > header is my spam trap, so I don't check it very often. You will get a
    > > quicker response by posting to the newsgroup.
    > >
    > >
    > >
    Jack, Mar 2, 2006
    #4
  5. Jack wrote:
    > Thanks Bob for your help. I am going to do that. However, the reason
    > I am using RS_Year("YEAR") for the option value is that I want to
    > display all the YEAR values in the the list box on the form.


    The Value is not displayed, the text is. Try it.

    --
    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"
    Bob Barrows [MVP], Mar 2, 2006
    #5
  6. Jack

    Bob Lehmann Guest

    I'm curious.

    Since each year only happens once, why do you have a yearID column? I'm not
    even really sure why you have a year table to begin with.

    Unless you know something......

    Bob Lehmann

    "Jack" <> wrote in message
    news:D...
    > Thanks Bob for your help. I am going to do that. However, the reason I am

    using
    > RS_Year("YEAR") for the option value is that I want to display all the

    YEAR
    > values in the the list box on the form. However, instead of Year I need

    to
    > capture the value of the corresponding code of the YEAR. This code goes to
    > the sql statement in the processing asp page. Thanks.
    >
    > Response.Write "<Option Value='" & RS_Year("YEARID")& "'>"
    >
    >
    > "Bob Barrows [MVP]" wrote:
    >
    > > Jack wrote:
    > > > Hi,
    > > > I have a asp form where one element is a list box which lists four
    > > > years starting from 2004. This list is drawn from a database table
    > > > which has YearID and Year as two fields as shown below:
    > > > YearID YEAR
    > > > 1 2004
    > > > 2 2005
    > > > 3 2006
    > > > 4 2007
    > > > PART OF ASP CODE IS:
    > > >
    > > > <tr>
    > > > <td width="74%" align ="center" height="18"><font face="Times New
    > > > Roman" size="3" color = "red">YEAR</font></td>
    > > > <td>
    > > > <SELECT NAME="lstYear" SIZE="1">
    > > >
    > > > <% Do while not RS_Year.EOF
    > > > Response.Write "<Option Value='" & RS_Year("YEAR")& "'>"
    > > > Response.Write RS_Year("YEAR") & "</OPTION>"
    > > > RS_Year.MoveNext
    > > > Loop
    > > > %>
    > > > <td>
    > > > <tr>
    > > >
    > > > Now I want to capture the value of the YearCode instead of the

    > >
    > > So why are you using RS_Year("YEAR") for the option value? Wouldn't it

    make
    > > more sense to change it to:
    > >
    > > Response.Write "<Option Value='" & RS_Year("YEARID")& "'>"
    > >
    > >
    > > > Year field and store the year code value in the processing form to
    > > > process in a sql statement.
    > > >
    > > > i.e. I am planning to use the Request.Form("lstYear") to capture the
    > > > value of the year code. However, Request.Form("listYear") is showing
    > > > no value.

    > >
    > > At what point in the process? After you submitted form containing the

    above
    > > SELECT element?
    > >
    > > Create a small test form that reproduces the problem and post the entire
    > > code from that SMALL test form.
    > >
    > > --
    > > Microsoft MVP -- ASP/ASP.NET
    > > Please reply to the newsgroup. The email account listed in my From
    > > header is my spam trap, so I don't check it very often. You will get a
    > > quicker response by posting to the newsgroup.
    > >
    > >
    > >
    Bob Lehmann, Mar 2, 2006
    #6
  7. Jack

    Jack Guest

    Bob, Actually I meant the text Year is displayed which is fine. The user need
    to click on the Year (e.g. 2004) to choose from the list. However, as I
    pointed out earlier that though 2004 is click I need to capture the
    corresponding YearID which is 1 in the present case (i.e. the year 2004 is
    chosen). Hope I am more clear now. I have got the sample code here. Any
    thoughts.

    "Bob Barrows [MVP]" wrote:

    > Jack wrote:
    > > Thanks Bob for your help. I am going to do that. However, the reason
    > > I am using RS_Year("YEAR") for the option value is that I want to
    > > display all the YEAR values in the the list box on the form.

    >
    > The Value is not displayed, the text is. Try it.
    >
    > --
    > 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"
    >
    >
    >
    Jack, Mar 2, 2006
    #7
  8. Jack

    Jack Guest

    OK,
    this is just a test. In reality this is a much bigger data entry form where
    various parties will enter 2004 and 2005 data via the web application. The
    Year list box helps them to have their choice instead of typing the value in.
    In the final table where all the data is collected the YearID is collected
    rather than the YEAR text. Hope I am little more clear. Thanks

    "Bob Lehmann" wrote:

    > I'm curious.
    >
    > Since each year only happens once, why do you have a yearID column? I'm not
    > even really sure why you have a year table to begin with.
    >
    > Unless you know something......
    >
    > Bob Lehmann
    >
    > "Jack" <> wrote in message
    > news:D...
    > > Thanks Bob for your help. I am going to do that. However, the reason I am

    > using
    > > RS_Year("YEAR") for the option value is that I want to display all the

    > YEAR
    > > values in the the list box on the form. However, instead of Year I need

    > to
    > > capture the value of the corresponding code of the YEAR. This code goes to
    > > the sql statement in the processing asp page. Thanks.
    > >
    > > Response.Write "<Option Value='" & RS_Year("YEARID")& "'>"
    > >
    > >
    > > "Bob Barrows [MVP]" wrote:
    > >
    > > > Jack wrote:
    > > > > Hi,
    > > > > I have a asp form where one element is a list box which lists four
    > > > > years starting from 2004. This list is drawn from a database table
    > > > > which has YearID and Year as two fields as shown below:
    > > > > YearID YEAR
    > > > > 1 2004
    > > > > 2 2005
    > > > > 3 2006
    > > > > 4 2007
    > > > > PART OF ASP CODE IS:
    > > > >
    > > > > <tr>
    > > > > <td width="74%" align ="center" height="18"><font face="Times New
    > > > > Roman" size="3" color = "red">YEAR</font></td>
    > > > > <td>
    > > > > <SELECT NAME="lstYear" SIZE="1">
    > > > >
    > > > > <% Do while not RS_Year.EOF
    > > > > Response.Write "<Option Value='" & RS_Year("YEAR")& "'>"
    > > > > Response.Write RS_Year("YEAR") & "</OPTION>"
    > > > > RS_Year.MoveNext
    > > > > Loop
    > > > > %>
    > > > > <td>
    > > > > <tr>
    > > > >
    > > > > Now I want to capture the value of the YearCode instead of the
    > > >
    > > > So why are you using RS_Year("YEAR") for the option value? Wouldn't it

    > make
    > > > more sense to change it to:
    > > >
    > > > Response.Write "<Option Value='" & RS_Year("YEARID")& "'>"
    > > >
    > > >
    > > > > Year field and store the year code value in the processing form to
    > > > > process in a sql statement.
    > > > >
    > > > > i.e. I am planning to use the Request.Form("lstYear") to capture the
    > > > > value of the year code. However, Request.Form("listYear") is showing
    > > > > no value.
    > > >
    > > > At what point in the process? After you submitted form containing the

    > above
    > > > SELECT element?
    > > >
    > > > Create a small test form that reproduces the problem and post the entire
    > > > code from that SMALL test form.
    > > >
    > > > --
    > > > Microsoft MVP -- ASP/ASP.NET
    > > > Please reply to the newsgroup. The email account listed in my From
    > > > header is my spam trap, so I don't check it very often. You will get a
    > > > quicker response by posting to the newsgroup.
    > > >
    > > >
    > > >

    >
    >
    >
    Jack, Mar 2, 2006
    #8
  9. Jack

    Mike Brind Guest

    Jack wrote:
    > OK,
    > this is just a test. In reality this is a much bigger data entry form where
    > various parties will enter 2004 and 2005 data via the web application. The
    > Year list box helps them to have their choice instead of typing the value in.
    > In the final table where all the data is collected the YearID is collected
    > rather than the YEAR text. Hope I am little more clear. Thanks
    >


    As Bob has already pointed out a couple of times, with a Select list,
    the value is passed with the form or querystring collection. So this:

    <option value="somevalue">Some Text</option>

    will display "Some Text" on the screen, but if it is selected, will
    pass "somevalue" to the collection. The only time "Some Text" will be
    passed is if you either leave the option value blank, or explicitly
    define the value as "Some Text". The latter is in effect what you are
    doing with RS("Year").

    Consequently, Bob's code will work in exactly the way you want it to.
    Try the test as he suggested.

    --
    Mike Brind
    Mike Brind, Mar 2, 2006
    #9
  10. Jack wrote:
    > Well Bob, I just trimmed my code to get a test asp page.


    :)
    Obviously, you and i have different ideas about what constitutes a "small"
    test page ;-)

    > Here please
    > note that the tblYear has YearId and Year field. I need to display
    > the Year Value, yet capture the YearId(ie. the selected one from the
    > list box) in the processing form using request object. This YearId
    > will go the sql statement in the processing form.This is the main
    > issue to me ie. how to display one field in the list box yet capture
    > the corresponding ID from the form in the processing asp page using
    > request form object. Hope I could explain well. Here is the code for
    > the test page. Thanks. Regards,
    >


    This is why I told you to set the value attribut to the YearID instead of
    the Year. here, try this to see:


    <!-- #include file="connection.asp" -->
    <!-- #include file="adovbs.inc" -->
    <%
    strSQL3 = "SELECT YearId, Year FROM tblYear"
    Set RS_Year =conn.execute(strsql3,,1)
    if not rs_year.eof then arData=rs_year.getrows
    rs_year.close:set rs_year=nothing
    conn.close: set conn=nothing
    sHTML=""
    if isarray(ardata) then
    for i = 0 to ubound(ardata,2)
    shtml = shtml & "<option value = """ & _
    ardata(0,i) & """>" & ardata(1,i) & "</option>"
    next
    end if
    if len(request.form("lstYear")) > 0 then
    response.write "The value of the option you selected is """ & _
    request.form("lstYear")
    end if
    %>
    <html><body><form method=POST >
    <SELECT NAME= "lstYear" SIZE="1">
    <%=shtml%>
    </SELECT>
    <input type="submit" value="Submit" >
    </form></body></html>

    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.
    Bob Barrows [MVP], Mar 2, 2006
    #10
  11. Jack

    Jack Guest

    This is a message for Bob.
    I am still not clear about the whole thing yert. Bob, I have posted the code
    using small test asp page as per your advise. Could you please let me know in
    the test code what exactly is wrong? Can you show me couple of lines of code
    in the test code to capture the chosen year (actually to capture yeardID)
    using request.form. Thanks.

    "Mike Brind" wrote:

    >
    > Jack wrote:
    > > OK,
    > > this is just a test. In reality this is a much bigger data entry form where
    > > various parties will enter 2004 and 2005 data via the web application. The
    > > Year list box helps them to have their choice instead of typing the value in.
    > > In the final table where all the data is collected the YearID is collected
    > > rather than the YEAR text. Hope I am little more clear. Thanks
    > >

    >
    > As Bob has already pointed out a couple of times, with a Select list,
    > the value is passed with the form or querystring collection. So this:
    >
    > <option value="somevalue">Some Text</option>
    >
    > will display "Some Text" on the screen, but if it is selected, will
    > pass "somevalue" to the collection. The only time "Some Text" will be
    > passed is if you either leave the option value blank, or explicitly
    > define the value as "Some Text". The latter is in effect what you are
    > doing with RS("Year").
    >
    > Consequently, Bob's code will work in exactly the way you want it to.
    > Try the test as he suggested.
    >
    > --
    > Mike Brind
    >
    >
    Jack, Mar 2, 2006
    #11
  12. Jack, did you try the test page i posted?

    Jack wrote:
    > This is a message for Bob.
    > I am still not clear about the whole thing yert. Bob, I have posted
    > the code using small test asp page as per your advise. Could you
    > please let me know in the test code what exactly is wrong? Can you
    > show me couple of lines of code in the test code to capture the
    > chosen year (actually to capture yeardID) using request.form. Thanks.
    >
    > "Mike Brind" wrote:
    >
    >>
    >> Jack wrote:
    >>> OK,
    >>> this is just a test. In reality this is a much bigger data entry
    >>> form where various parties will enter 2004 and 2005 data via the
    >>> web application. The Year list box helps them to have their choice
    >>> instead of typing the value in. In the final table where all the
    >>> data is collected the YearID is collected rather than the YEAR
    >>> text. Hope I am little more clear. Thanks
    >>>

    >>
    >> As Bob has already pointed out a couple of times, with a Select list,
    >> the value is passed with the form or querystring collection. So
    >> this:
    >>
    >> <option value="somevalue">Some Text</option>
    >>
    >> will display "Some Text" on the screen, but if it is selected, will
    >> pass "somevalue" to the collection. The only time "Some Text" will
    >> be passed is if you either leave the option value blank, or
    >> explicitly define the value as "Some Text". The latter is in effect
    >> what you are doing with RS("Year").
    >>
    >> Consequently, Bob's code will work in exactly the way you want it to.
    >> Try the test as he suggested.
    >>
    >> --
    >> Mike Brind


    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.
    Bob Barrows [MVP], Mar 2, 2006
    #12
  13. Jack

    Jack Guest

    Sorry Bob,
    I overlooked the code you posted. I apologize for it. I am going to try
    it.Regards.

    "Bob Barrows [MVP]" wrote:

    > Jack, did you try the test page i posted?
    >
    > Jack wrote:
    > > This is a message for Bob.
    > > I am still not clear about the whole thing yert. Bob, I have posted
    > > the code using small test asp page as per your advise. Could you
    > > please let me know in the test code what exactly is wrong? Can you
    > > show me couple of lines of code in the test code to capture the
    > > chosen year (actually to capture yeardID) using request.form. Thanks.
    > >
    > > "Mike Brind" wrote:
    > >
    > >>
    > >> Jack wrote:
    > >>> OK,
    > >>> this is just a test. In reality this is a much bigger data entry
    > >>> form where various parties will enter 2004 and 2005 data via the
    > >>> web application. The Year list box helps them to have their choice
    > >>> instead of typing the value in. In the final table where all the
    > >>> data is collected the YearID is collected rather than the YEAR
    > >>> text. Hope I am little more clear. Thanks
    > >>>
    > >>
    > >> As Bob has already pointed out a couple of times, with a Select list,
    > >> the value is passed with the form or querystring collection. So
    > >> this:
    > >>
    > >> <option value="somevalue">Some Text</option>
    > >>
    > >> will display "Some Text" on the screen, but if it is selected, will
    > >> pass "somevalue" to the collection. The only time "Some Text" will
    > >> be passed is if you either leave the option value blank, or
    > >> explicitly define the value as "Some Text". The latter is in effect
    > >> what you are doing with RS("Year").
    > >>
    > >> Consequently, Bob's code will work in exactly the way you want it to.
    > >> Try the test as he suggested.
    > >>
    > >> --
    > >> Mike Brind

    >
    > --
    > Microsoft MVP -- ASP/ASP.NET
    > Please reply to the newsgroup. The email account listed in my From
    > header is my spam trap, so I don't check it very often. You will get a
    > quicker response by posting to the newsgroup.
    >
    >
    >
    Jack, Mar 2, 2006
    #13
  14. Jack

    Jack Guest

    Hi Bob,
    I tried your code and it works now. Thanks a lot for the generous help. Best
    regards.

    "Jack" wrote:

    > Sorry Bob,
    > I overlooked the code you posted. I apologize for it. I am going to try
    > it.Regards.
    >
    > "Bob Barrows [MVP]" wrote:
    >
    > > Jack, did you try the test page i posted?
    > >
    > > Jack wrote:
    > > > This is a message for Bob.
    > > > I am still not clear about the whole thing yert. Bob, I have posted
    > > > the code using small test asp page as per your advise. Could you
    > > > please let me know in the test code what exactly is wrong? Can you
    > > > show me couple of lines of code in the test code to capture the
    > > > chosen year (actually to capture yeardID) using request.form. Thanks.
    > > >
    > > > "Mike Brind" wrote:
    > > >
    > > >>
    > > >> Jack wrote:
    > > >>> OK,
    > > >>> this is just a test. In reality this is a much bigger data entry
    > > >>> form where various parties will enter 2004 and 2005 data via the
    > > >>> web application. The Year list box helps them to have their choice
    > > >>> instead of typing the value in. In the final table where all the
    > > >>> data is collected the YearID is collected rather than the YEAR
    > > >>> text. Hope I am little more clear. Thanks
    > > >>>
    > > >>
    > > >> As Bob has already pointed out a couple of times, with a Select list,
    > > >> the value is passed with the form or querystring collection. So
    > > >> this:
    > > >>
    > > >> <option value="somevalue">Some Text</option>
    > > >>
    > > >> will display "Some Text" on the screen, but if it is selected, will
    > > >> pass "somevalue" to the collection. The only time "Some Text" will
    > > >> be passed is if you either leave the option value blank, or
    > > >> explicitly define the value as "Some Text". The latter is in effect
    > > >> what you are doing with RS("Year").
    > > >>
    > > >> Consequently, Bob's code will work in exactly the way you want it to.
    > > >> Try the test as he suggested.
    > > >>
    > > >> --
    > > >> Mike Brind

    > >
    > > --
    > > Microsoft MVP -- ASP/ASP.NET
    > > Please reply to the newsgroup. The email account listed in my From
    > > header is my spam trap, so I don't check it very often. You will get a
    > > quicker response by posting to the newsgroup.
    > >
    > >
    > >
    Jack, Mar 2, 2006
    #14
  15. I guess the key question now is: do you understand why it works when your
    original didn't?

    Jack wrote:
    > Hi Bob,
    > I tried your code and it works now. Thanks a lot for the generous
    > help. Best regards.
    >
    > "Jack" wrote:
    >
    >> Sorry Bob,
    >> I overlooked the code you posted. I apologize for it. I am going to
    >> try it.Regards.
    >>
    >> "Bob Barrows [MVP]" wrote:
    >>
    >>> Jack, did you try the test page i posted?
    >>>
    >>> Jack wrote:
    >>>> This is a message for Bob.
    >>>> I am still not clear about the whole thing yert. Bob, I have posted
    >>>> the code using small test asp page as per your advise. Could you
    >>>> please let me know in the test code what exactly is wrong? Can you
    >>>> show me couple of lines of code in the test code to capture the
    >>>> chosen year (actually to capture yeardID) using request.form.
    >>>> Thanks.
    >>>>
    >>>> "Mike Brind" wrote:
    >>>>
    >>>>>
    >>>>> Jack wrote:
    >>>>>> OK,
    >>>>>> this is just a test. In reality this is a much bigger data entry
    >>>>>> form where various parties will enter 2004 and 2005 data via the
    >>>>>> web application. The Year list box helps them to have their
    >>>>>> choice instead of typing the value in. In the final table where
    >>>>>> all the data is collected the YearID is collected rather than
    >>>>>> the YEAR text. Hope I am little more clear. Thanks
    >>>>>>
    >>>>>
    >>>>> As Bob has already pointed out a couple of times, with a Select
    >>>>> list, the value is passed with the form or querystring
    >>>>> collection. So this:
    >>>>>
    >>>>> <option value="somevalue">Some Text</option>
    >>>>>
    >>>>> will display "Some Text" on the screen, but if it is selected,
    >>>>> will pass "somevalue" to the collection. The only time "Some
    >>>>> Text" will be passed is if you either leave the option value
    >>>>> blank, or explicitly define the value as "Some Text". The latter
    >>>>> is in effect what you are doing with RS("Year").
    >>>>>
    >>>>> Consequently, Bob's code will work in exactly the way you want it
    >>>>> to. Try the test as he suggested.
    >>>>>
    >>>>> --
    >>>>> Mike Brind
    >>>
    >>> --
    >>> Microsoft MVP -- ASP/ASP.NET
    >>> Please reply to the newsgroup. The email account listed in my From
    >>> header is my spam trap, so I don't check it very often. You will
    >>> get a quicker response by posting to the newsgroup.


    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.
    Bob Barrows [MVP], Mar 2, 2006
    #15
  16. Jack

    Jack Guest

    Bob, I am clear on the concept now. Thanks. Regards.

    "Bob Barrows [MVP]" wrote:

    > I guess the key question now is: do you understand why it works when your
    > original didn't?
    >
    > Jack wrote:
    > > Hi Bob,
    > > I tried your code and it works now. Thanks a lot for the generous
    > > help. Best regards.
    > >
    > > "Jack" wrote:
    > >
    > >> Sorry Bob,
    > >> I overlooked the code you posted. I apologize for it. I am going to
    > >> try it.Regards.
    > >>
    > >> "Bob Barrows [MVP]" wrote:
    > >>
    > >>> Jack, did you try the test page i posted?
    > >>>
    > >>> Jack wrote:
    > >>>> This is a message for Bob.
    > >>>> I am still not clear about the whole thing yert. Bob, I have posted
    > >>>> the code using small test asp page as per your advise. Could you
    > >>>> please let me know in the test code what exactly is wrong? Can you
    > >>>> show me couple of lines of code in the test code to capture the
    > >>>> chosen year (actually to capture yeardID) using request.form.
    > >>>> Thanks.
    > >>>>
    > >>>> "Mike Brind" wrote:
    > >>>>
    > >>>>>
    > >>>>> Jack wrote:
    > >>>>>> OK,
    > >>>>>> this is just a test. In reality this is a much bigger data entry
    > >>>>>> form where various parties will enter 2004 and 2005 data via the
    > >>>>>> web application. The Year list box helps them to have their
    > >>>>>> choice instead of typing the value in. In the final table where
    > >>>>>> all the data is collected the YearID is collected rather than
    > >>>>>> the YEAR text. Hope I am little more clear. Thanks
    > >>>>>>
    > >>>>>
    > >>>>> As Bob has already pointed out a couple of times, with a Select
    > >>>>> list, the value is passed with the form or querystring
    > >>>>> collection. So this:
    > >>>>>
    > >>>>> <option value="somevalue">Some Text</option>
    > >>>>>
    > >>>>> will display "Some Text" on the screen, but if it is selected,
    > >>>>> will pass "somevalue" to the collection. The only time "Some
    > >>>>> Text" will be passed is if you either leave the option value
    > >>>>> blank, or explicitly define the value as "Some Text". The latter
    > >>>>> is in effect what you are doing with RS("Year").
    > >>>>>
    > >>>>> Consequently, Bob's code will work in exactly the way you want it
    > >>>>> to. Try the test as he suggested.
    > >>>>>
    > >>>>> --
    > >>>>> Mike Brind
    > >>>
    > >>> --
    > >>> Microsoft MVP -- ASP/ASP.NET
    > >>> Please reply to the newsgroup. The email account listed in my From
    > >>> header is my spam trap, so I don't check it very often. You will
    > >>> get a quicker response by posting to the newsgroup.

    >
    > --
    > Microsoft MVP -- ASP/ASP.NET
    > Please reply to the newsgroup. The email account listed in my From
    > header is my spam trap, so I don't check it very often. You will get a
    > quicker response by posting to the newsgroup.
    >
    >
    >
    Jack, Mar 3, 2006
    #16
    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. Replies:
    1
    Views:
    1,143
    David Wier
    Aug 5, 2005
  2. Neelu
    Replies:
    1
    Views:
    539
    TechBookReport
    Jan 10, 2006
  3. Gnarlodious
    Replies:
    4
    Views:
    17,565
    elizas
    May 5, 2010
  4. Jon   Paal
    Replies:
    0
    Views:
    397
    Jon Paal
    Sep 27, 2006
  5. Adrian
    Replies:
    1
    Views:
    210
    Bullschmidt
    Feb 18, 2004
Loading...

Share This Page