extracting form data

Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.

  1. #1

    Default extracting form data

    I have a form that allows you to change responses for a list of users. Each
    user has a line with options. THE FIELD NAME IS DETERMINED BY THE USERID. So
    the field name for userid 4327 is answer_4327 and so on. The page has up to
    500 user answers that can be manipulated.

    <input type="Radio" name="answer_#userid#" value="Y">Yes
    <input type="Radio" name="answer_#userid#" value="N">No
    <input type="Radio" name="answer_#userid#" value="M">Maybe

    When I send the answers to the process page, I don't know how to get at the
    data. First I loop through all users taking the test.


    <cfloop query="users_taking_test">

    On each pass, I verify that the form.field exists for each user I am seeking
    to process.

    <cfif isdefined("form.status_#userid#")>

    Once I determine the form field exists, I am stumped as to how to get at the
    data in it!

    I can't say: <cfset new_answer = form.status_#userid#>
    And putting it in quotes doesn't work:
    <cfset new_answer = "form.status_#userid#"> makes new_answer =
    "form.status_4327 " rather than the value of the form field (Y,N or M)

    Ideally, I'd like to be able to enter the data directly into the db:

    <cfquery datasource="#application.chatdb#" dbtype="ODBC" name="update">
    UPDATE test_answers SET answer = '#form.status_#userid##'
    WHERE testID = #form.testid# and userid=#userid#
    </cfquery>

    I can't figure it out. Does anyone know how to extract the value of the form
    field that uses this unusual naming convention

    thanks in advance!

    jim

    :confused;

    cascadiaweb Guest

  2. Similar Questions and Discussions

    1. Extracting value from data within an element.
      Hello forum. I have written a perl script that will parse XML files and extract certain elements and put them into a comma delimited file. This...
    2. Extracting Data from Datagrid
      I have a developer that wants to dump data from a datagrid to an external file. I am thinking a .csv file for simplicity sake. I had thought about...
    3. extracting data from a value list
      Hi all, What I'd like to do is extract the data from a value list of "categories" and paste the data into a repetitive text field. I'm able to...
    4. Extracting web data
      Can anyone point me to java packages which aid in parsing web pages? TIA matt
    5. Extracting data from the Internet
      I'm a newbie with Perl and can extract data from Web Pages, but need guidance on how to use perl to extract files from websites that you would...
  3. #2

    Default Re: extracting form data

    assuming you're on a relatively modern version of cf, this should work:

    <cfset new_answer = form["status_#userid#"]>

    btw that's seems like an unreaonsable amount of complication for a form.
    PaulH Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139