Thread: Request.Form or Request.QueryString on textbox?

Results 1 to 3 of 3
Share This Thread →
  1. #1
    mrcshbs is offline Registered User ASP Free Newbie (0 - 499 posts)
    Join Date
    Oct 2012
    Location
    Saint Louis
    Posts
    6
    Rep Power
    0

    Request.Form or Request.QueryString on textbox?

    Hi, guys, I have a quick question… I am trying to figure this out, but it’s killing me.
    I have a single textbox (generated by ASP)… and what I am trying to do is make the first option onthe textbox, (session variable) display in a “friendly” way.

    The textbox name is “Range”

    When I change the values, it posts the form to the same page, with the following:

    If request.form("Range") = "" Then
    Session("Range")=""
    Elseif request.form("Range") = "0" Then
    Session("Range")="Today"
    Elseif request.form("Range") = "1" Then
    Session("Range")="Yesterday"
    Else
    Session("Range")=Session("Range") & " Days"
    End If

    This textbox actually get the values from a database… so

    How can I make this textbox display?
    If 0 = display “Today”
    If 1 = Display Yesterday
    But anything above that display the number PLUS the word days: Example: 7 Days

    As soon I post the form again without changing the textbox, it says 7 Days Days, and then if I post again, it says 7 Days Days Days and so on…

    If I reset the form, and select the textbox from scratch, it displays correctly, but the second you post it again, keeps adding the word days.

    Any ideas?

    Thanks

    Values: (in order)
    Session(“Range”)
    Disabled
    0
    1
    7
    14
    30
    60
    90

    This text box has a onchange=this.form.submit

  2. #2
    sqlconfused is offline Contributing User ASP Free Newbie (0 - 499 posts)
    Join Date
    Oct 2012
    Posts
    48
    Rep Power
    1
    If request.form("Range") = "" Then
    Session("Range")=""
    Elseif request.form("Range") = "0" Then
    Session("Range")="Today"
    Elseif request.form("Range") = "1" Then
    Session("Range")="Yesterday"
    Else
    Session("Range")=request.form("Range") & " Days"End If

  3. #3
    gk53's Avatar
    gk53 is offline Contributing User ASP Free Beginner (1000 - 1499 posts)
    Join Date
    Mar 2005
    Location
    Columbus, OH
    Posts
    1,223
    Rep Power
    263
    keep in session only number of days and convert to words after post back
    if session("Range")="" then
    'do nothing
    elseif session("Range")="0" then
    response.write "Today"
    elseif session("Range")="1" then
    response.write "Yesterday"
    else
    response.wirte session("Range") & " Days"
    end if
    GK
    __________________________________________________ _____
    if you found this post is useful click scale (right side on this reply ) and agree

Share This Thread →

Become Part of This Conversation

Join NowFor Free!

Similar Threads

  1. Request.Querystring and Request.Form
    By richga in forum ASP Development
    Replies: 7
    Last Post: May 21st, 2007, 05:28 AM
  2. request.form vs request.querystring
    By johnpaul in forum ASP Development
    Replies: 2
    Last Post: November 4th, 2005, 11:42 AM
  3. Request.Form/QueryString
    By Calldean in forum ASP Development
    Replies: 27
    Last Post: April 20th, 2005, 02:50 AM
  4. request.form() vs. request.querystring()
    By Feezo in forum ASP Development
    Replies: 9
    Last Post: March 10th, 2005, 08:14 AM
  5. difference between request.form, request.querystring
    By Steve Schofield in forum ASP Development
    Replies: 2
    Last Post: January 5th, 2004, 08:44 AM

ASP Free Advertisers and Affiliates