Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Feb 2003
    Location
    Manssas, VA
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Using Numeric Data Collected From Forms

    Hello,

    I'm having a problem using a numeric data element submitted by my form. I'm checking for a numeric value, but it seems to be coming in blank. Is it necessary to convert the item to an integer?

    *** This code doesn't work - Num_PPAC form item sets TNT:
    If ((Request("Num_PPAC") <> "") And (isnumeric(Request("Num_PPAC")))) Then

    TNT = CInt(Num_PPAC)

    ReDim Temp_PPADCode(TNT)

    If Request("GenCodes") <> "" Then
    X = 1
    Do while X <= TNT
    RandStuff = RndStr(7,"123456789abcdefghijkmnpqrstuvwxyz")
    Temp_PPADCode(X) = Request("PPAC_PREFIX") & RandStuff
    X = X + 1
    Loop
    pMsg = "TNT&nbsp;=&nbsp;" & TNT
    Session("STemp_PPADCode") = Temp_PPADCode

    End If

    *** This code does work - TNT set to 10:
    If ((Request("Num_PPAC") <> "") And (isnumeric(Request("Num_PPAC")))) Then

    TNT = 10

    ReDim Temp_PPADCode(TNT)

    If Request("GenCodes") <> "" Then
    X = 1
    Do while X <= TNT
    RandStuff = RndStr(7,"123456789abcdefghijkmnpqrstuvwxyz")
    Temp_PPADCode(X) = Request("PPAC_PREFIX") & RandStuff
    X = X + 1
    Loop
    pMsg = "TNT&nbsp;=&nbsp;" & TNT
    Session("STemp_PPADCode") = Temp_PPADCode

    End If


    Thanks.

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,048
    Thanks
    0
    Thanked 251 Times in 247 Posts
    this is a javascript forum and not an ASP forum. you should have posted in the right forum.
    Anyway, here's the answer.

    if the item you request is used many times, it is advisable to put it in a variable. And it is also more efficient if you specify what request collection you are accessing rather than just specifying Request(item)

    dim ppac
    ppac = Request.Form("Num_PPAC") 'if method is POST
    'ppac = Request.Querystring("Num_PPAC") 'if method is GET
    If ppac <> "" And isnumeric(ppac) Then

    TNT = CInt(ppac)
    ...

  • #3
    New to the CF scene
    Join Date
    Feb 2003
    Location
    Manssas, VA
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thanks

    Hey Glenn,

    I just wanted to say thanks for your help, and to let you know that now my code is working fine, plus I've learned more about ASP and forms.


  •  

    Posting Permissions

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