www.webdeveloper.com
Results 1 to 5 of 5

Thread: Help needed with Drop-down list and links in asp

  1. #1
    Join Date
    Apr 2010
    Posts
    11

    Help needed with Drop-down list and links in asp

    I have two links, year drop-down list and button. User selects the year and clicks on one of the link to go to specific page. ex: If user selects 2010 and click on first link, it should go to first.asp page where that years data is displayed. If he clicks on second link, it goes to second.asp page. Year variable to be passed to other pages as well. It is simple but I am not able to make this happen. FYI - New to asp.

    Here is my drop-down list configuration
    <Select Name=YearSel>
    <Option selected>
    <% SQLQUERY= "select Year from YearTable where ID = '"&id&"' "
    Set list=conn.execute(SQLQUERY)

    Do While Not list.EOF
    YearSel=list("Year")
    Response.Write "<OPTION>" & YearSel
    list.MoveNext
    Loop %>
    </SELECT>
    <INPUT TYPE="Submit" VALUE="Go" ONCLICK="go()" id=SUBMIT1 name=SUBMIT1>

    PLEASE HELP.....

  2. #2
    Join Date
    Apr 2010
    Posts
    11

    Extension

    I have this java script in place for GO button above....but it always goes to else part

    function func1(){
    if (document.form.YearSel.value > "2011")
    {
    document.form.action ="Test.asp";
    document.form.method = "post";
    document.form.submit();

    }
    else
    {
    alert("alert else");
    }

    }

  3. #3
    Join Date
    Nov 2007
    Posts
    409
    "2011" (in quotes) is text, not a number.

    try like this:
    Code:
    var YearSel = parseFloat(document.form.YearSel.value);
    
    if (YearSel > 2011){
    ...
    }

  4. #4
    Join Date
    Apr 2010
    Posts
    11
    Thank you for the response nap0leon....It is not working...I feel that YearSel is not getting the selected value...Do you think there is any problem with drop-down function.
    When I select the Year and click go, it goes to else part of it....

  5. #5
    Join Date
    Apr 2010
    Posts
    11
    I have a response.write(YearSel) in page after the YearSel = request.form(YearSel) and it shows as 2010, 2001. Why it is displaying two years when 2010 is alone selected.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles