Results 1 to 4 of 4

Thread: UBound in ASP

  1. #1
    Super Moderator WebGenii's Avatar
    Join Date
    Jan 2001
    Location
    Redcliff, Alberta, Canada
    Posts
    4,066
    Thanks
    2
    Thanked 5 Times in 5 Posts

    UBound in ASP

    I'm having trouble implementing an array on my ASP page.
    I'm adapting a script to check for content in required fields in a form and reflect that information back to the user.
    <% if Request.Form("_requiredFields") <> "" then
    required = Split(Request.Form("_requiredFields"), ",")
    for each name in required
    name = Trim(name)
    if Left(name, 1) <> "_" and Request.Form(name) = "" then
    call AddErrorMsg("Missing value for " & name)
    end if
    next
    end if
    sub AddErrorMsg(msg)
    'Add an error message to the list.
    n = UBound(errorMsgs)
    Redim Preserve errorMsgs(n + 1)
    errorMsgs(n + 1) = msg
    end sub

    %>

    I'm thinking there is something (ok a LOT) I don't know about the implementation of VBScript within ASP.
    [b]Catharine Richardson (WebGenii)
    WebGenii Home Page
    Moderator: Spreadsheets, Other MS Apps, Presentation Apps, Visual Basic for Apps, Windows Mobile

  2. #2
    Platinum Lounger
    Join Date
    Dec 2000
    Location
    Hornsby Heights, New South Wales, Australia
    Posts
    3,822
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: UBound in ASP

    Without actually trying this code (I don't have your form <img src=/S/smile.gif border=0 alt=smile width=15 height=15>) and without knowing what the trouble is, I'd say try this one:
    <code>
    <%
    Dim errorMsgs()
    Dim n as integer

    if Request.Form("_requiredFields") <> "" then
    required = Split(Request.Form("_requiredFields"), ",")
    for each name in required
    name = Trim(name)
    if Left(name, 1) <> "_" and Request.Form(name) = "" then
    n = UBound(errorMsgs)
    Redim Preserve errorMsgs(n + 1)
    errorMsgs(n + 1) = "Missing value for " & name
    end if
    next
    end if
    %>

    </code><small>note to self: must check why <!t>[code]<!/t> tag doesn't preserve indenting in the lounge</small>
    Cheers, Claude.

  3. #3
    Super Moderator WebGenii's Avatar
    Join Date
    Jan 2001
    Location
    Redcliff, Alberta, Canada
    Posts
    4,066
    Thanks
    2
    Thanked 5 Times in 5 Posts

    Re: UBound in ASP

    thanks!
    [b]Catharine Richardson (WebGenii)
    WebGenii Home Page
    Moderator: Spreadsheets, Other MS Apps, Presentation Apps, Visual Basic for Apps, Windows Mobile

  4. #4
    Platinum Lounger
    Join Date
    Nov 2001
    Location
    Vienna, Wien, Austria
    Posts
    5,009
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: UBound in ASP

    >note to self: must check why [code] tag doesn't preserve indenting in the lounge

    Could it be because the <!t>[code]<!/t> tag was introduced to enable Fixed Width fonting inside a paragraph? The <!t>[pre]<!/t> tag - which does preserve indenting - has been doing yeoman's work for quite some time.

    HTH
    Gre

Posting Permissions

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