Responses from a randomized form?

Results 1 to 3 of 3

Thread: Responses from a randomized form?

  1. #1
    Jason Miller Guest

    Default Responses from a randomized form?

    Is there any way to retrieve values and names from a submitted form without knowing name(s) for what has been submitted?<BR><BR>Situation: Users are filling in test results 10ish at a time in some arbitrary position on a db. I want to be able to retrieve the position (name of form element) and the value the user set it to. I could have sworn I stumbled across it last summer (then forgot it since I didn&#039t need it then), but I can&#039t remember how... simply saying "for each item in request.form" tosses an error.<BR><BR>If necessary, I can code my own form object, but that&#039s painfully inefficient.

  2. #2
    Join Date
    Dec 1969

    Default RE: Responses from a randomized form?

    you&#039re close..<BR>assuming your form is a "post"<BR><BR>Dim f<BR>for each f in request.form<BR>response.write f & " " request.form(f)<BR>next<BR><BR>you&#039ll get a bunch of name/value pairs,<BR>but use a clever if statement during the loop<BR>and you&#039ll clean out the crap

  3. #3
    Jason Miller Guest

    Default Thanks! Now, the source...

    For Each result In Request.form<BR> strTable = Right(result, InStr(result, "_"))<BR> iCode = Left(result, InStr(result, "_") - 1)<BR> Call doSQL("update [" & projName & strTable & "s] set " & strColumn & " = &#039" & Request.form(result) & "&#039 where testCode = " & iCode)<BR>Next<BR><BR>This takes the whole of a posted form (where fields are named "#_Type" [i.e. "7_Comment"]) and posts each result to a spot (specified by the number and an column name [external]) in a table (specified by the type). Essentially, it&#039s a 3-dimensional database update.<BR><BR>It may have problems with non-strings; I haven&#039t actually run it through testing yet -- but working around that is easy.

Posting Permissions

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