#1
  1. No Profile Picture
    Registered User
    ASP Explorer (0 - 99 posts)

    Join Date
    Oct 2012
    Location
    Saint Louis
    Posts
    10
    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
  3. No Profile Picture
    Contributing User
    ASP Explorer (0 - 99 posts)

    Join Date
    Oct 2012
    Posts
    49
    Rep Power
    2
    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
  4. #3
  5. Contributing User
    ASP Skiller (1500 - 1999 posts)

    Join Date
    Mar 2005
    Location
    Columbus, OH
    Posts
    1,581
    Rep Power
    278
    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 Give Rep button (bottom side on this reply ) and agree

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

IMN logo majestic logo threadwatch logo seochat tools logo