Web Analytics Made Easy -
StatCounter wildcard character in retrieving fields from the form 'server side' - CodingForum

Announcement

Collapse
No announcement yet.

wildcard character in retrieving fields from the form 'server side'

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • wildcard character in retrieving fields from the form 'server side'

    Hi everybody, I have a form with a bunch of fields submitted to the server, the first characters in the field names are the same for all of them, followed by an incremental number, then "any characters" ej..

    sunbox15_1_b151, sunbox15_1_b152, sunbox15_1_b153...and so on...my idea is to retrieve them using something like

    for i=1 to request.form("sunbox15_1_" & somewildcharacter).count
    Response.Write(Request.Form("sunbox15_1_" & suffix)(i) & "<br>")
    next

    any ideas......???

  • #2
    This has nothing to do with DOM Scripting. Please post in an appropriate forum next time. I'll move this to the ASP section.
    jasonkarldavis.com

    Comment


    • #3
      You must know beforehand the range of the suffix. Since it looks like the field names are dynamically generated, also put hidden fields that will contain the range of the suffix -- from and to.
      Code:
      fromSuffix = Request.form("fromSuffix")
      toSuffix = Request.form("toSuffix")
      if not isnumeric(fromSuffix) or not isnumeric(toSuffix)
        response.write "Range Error"
        response.end
      end if
      
      fromSuffix = cint(fromSuffix)
      toSuffix = cint(toSuffix)
      
      for i=fromSuffix to toSuffix
        Response.Write(Request.Form("sunbox15_1_" & i & "<br>"))
      next
      Glenn
      vBulletin Mods That Rock!

      Comment


      • #4
        From your example code, I can't see why you don't just get a string and then split it into an array using the comma (",") as a delimiter?

        If you want to retrieve checkbox values that don't exist, you'd basically do the same thing, but just define them all before you request them... then use a related array (like checkboxname_(i))...



        If indeed you're using checkboxes, only checked checkboxes are posted via HTTP.
        Last edited by whammy; Feb 18, 2004, 10:34 PM.
        Former ASP Forum Moderator - I'm back!

        If you can teach yourself how to learn, you can learn anything. ;)

        Comment


        • #5
          Thanks I did that

          Thanks, What I did was to loop to get all the Items from the form then just used the Left(Item,3) to get the specific fields I'm using... similar to your suggestion

          Comment

          Working...
          X