Help with dynamic output using Form.variable

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

  1. #1

    Default Help with dynamic output using Form.variable

    Well here is my situation:

    Survey answers insert into access db. Working fine.

    Viewing the results:
    I have a form that you can choose by who enter it and what answer to a
    question you want to view.
    My is, I think working fine. Its the output list that is not, all I get is
    variable name the amount of times it is in the db instead of getting the
    answers to the question.

    So, when #Form.question# = FA1 3 times in the answers table. My output is,
    minus the <hr> :
    FA1
    FA1
    FA1

    What am I not understanding here?

    Here is the query:
    <cfquery name="yourView" datasource="development">
    SELECT '#Form.question#' FROM answers WHERE staffTitle = ('#Form.position#')
    </cfquery>
    Here is what I am trying to use to get my output:
    <cfoutput query="yourview">
    <td width="715" class="bullets">
    <p>#Form.question#<br></p>
    <hr align="left" width="50%" size="1" noshade>
    </cfoutput>




    jen_ren Guest

  2. Similar Questions and Discussions

    1. Passing Dynamic Variable In A Hidden Form
      Hello: I am trying to pass a hidden variable from a form on my web application to the PayPal site for payment processing. I can get my code to...
    2. dynamic variable name and output problem
      Hey all, I having trouble with dynamically naming a variable and then outputting the value. If I hard code the output blick below to #scoreAvg#, it...
    3. Reading dynamic FORM variable value
      I am receiving the following error: Element cb_2 is undefined in a Java object of type class coldfusion.filter.FormScope referenced as The Error...
    4. output variable to txt file
      I made a flash program that finds prime numbers. These prime numbers are put into a string which gets longer and longer vPrimeString =...
    5. Can't output a variable to HTML
      I have this code on a page: <p class="appTitle"> <?php echo "$appTitle"; ?> </p> But the resulting HTML is: <p class="appTitle"> </p>
  3. #2

    Default Re: Help with dynamic output using Form.variable

    It looks like you have a couple of mistakes in your code. To use the form
    input to specify a field name in the select, don't use quotes. You just want CF
    to substitute the value into the SQL statement (such as SELECT FA1 and not
    SELECT 'FA1' ). In your output, you are specifying the text value of the form
    field, not the database field with that name. If you use AS in your SQL to give
    the field name an alias, this will be easier.

    <cfquery name="yourView" datasource="development">
    SELECT #Form.question# AS question FROM answers WHERE staffTitle =
    ('#Form.position#')
    </cfquery>
    <cfoutput query="yourview">
    #question#<br>
    </cfoutput>

    dempster Guest

  4. #3

    Default Re: Help with dynamic output using Form.variable

    Thanks for helping me see that. It works perfectly now.
    Feel like I belong in duhhhhhville!!!! HAHAHAHa
    Have a great day:D:brokenheart;
    jen_ren 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