Skip to main content
Participant
May 8, 2008
Question

Help! - CFM Form Processor

  • May 8, 2008
  • 4 replies
  • 560 views
I'm working on a product suggestion calculator in the agriculture industry. I am a complete newbie (I just got my Ben Forta web application construction kit yesterday). Below is a copy of my form and the coldfusion processor I'm attempting to use. Again, I honestly have know idea what I'm doing as I'm sure is evident in the code. If anyone has any suggestion on how I can get my test to work without the error message I would greatly appreciate it. Thanks.

<form action="results_all.cfm" method="post">
<select name="choice" size="1">

<option value ="grains_form.html" selected="selected">Grains (Corn and Soybeans)</option>

<option value ="livestock_form.html">Livestock</option>

<option value ="dairy_form.html">Dairy</option>

<option value ="n_grains_form.html">Northern Grains (Wheat, Canola, etc.)</option>
<
option value ="s_crops_form.html">Southern Crops (Cotton, Rice)</option>
</select>

<select name="secondary">

<option value ="grains2">Grains (Corn and Soybeans)</option>

<option value ="livestock2">Livestock</option>

<option value ="dairy2">Dairy</option>

<option value ="n_grains2">Northern Grains (Wheat, Canola, etc.)</option>
<option value ="s_crops2">Southern Crops (Cotton, Rice)</option>
<option value ="none2">None</option>

</select>

<select name="op_size">

<option value ="acres1">Less than 500 acres</option>

<option value ="acres2">Between 500 - 1000 acres</option>

<option value ="acres3">1000 acres or more</option>

</select>

<select name="dec_makers">

<option value ="dec_1">1</option>

<option value ="dec_2">2</option>

<option value ="dec_3">3</option>

<option value ="dec_4">4 or more</option>

</select>

<select name="impact">

<option value ="impact1">Minimal impact</option>

<option value ="impact2">Moderate impact</option>

<option value ="impact3">Significant impact</option>

</select>

<select name="connection">

<option value ="connect1">High-Speed Internet</option>

<option value ="connect2">High-Speed Satellite</option>

<option value ="connect3">Via Cell Phone</option>

<option value ="connect4">All the above</option>

</select>

<input type="submit" name="Submit" id="Submit" value="Submit" />
</form>


<!--- Set Variables --->

<cfset question1 = "#Form.choice#">

<cfset question2 = "#Form.secondary#">
<cfset question3 = "#Form.op_size#">
<cfset question4 = "#Form.dec_makers#">
<cfset question5 = "#Form.impact#">
<cfset question6 = "#Form.connection#">

<!--- If Statement 1 --->

<cfif #question1# IS "Grains (Corn and Soybeans)" AND #question2# IS "None" AND #question3# IS "Between 500 - 1000 acres" AND #question4# IS "2" AND #question5# IS "Moderate impact" AND #question6# IS "High-Speed Internet">

<!--- Output if Question1 is True --->

<div id="grains_pro_piaall" Test - Answers equal grains, none, 500-1000, 2, moderate, internet.</div>

</cfif>


<!--- End CFM --->
    This topic has been closed for replies.

    4 replies

    Participant
    May 8, 2008
    The <cfdump> tag helped a lot. I didn't realize the form data that was being submitted is actually the value assigned to the <option> tag. I thought it was grabbing the actual text. That's why I came to you guys. Thank you for showing me the ways of the CFM force.
    Inspiring
    May 8, 2008
    From your description I'm assuming the form and result page are two different files. What type of error are you getting? Have you run any other cf pages successfully on your setup before this one?

    In debugging their are a couple very useful tools, <cfdump> and <cfabort>. For example if you want to see if the form data is being submitted to the coldfusion page correctly and prevent a cf error from occuring, put this code at the top of the cf page: <cfdump var="#form#"><cfabort>
    Participant
    May 8, 2008
    Yes, these are two separate pages. The first is an html form page - grains_form.html the second is the processor - results_all.cfm. I will try running the <cfdump> and <cfabort> tags. I appreciate your input - as I said earlier in the post I've just started working with CFM so I'm sure that I've mucked something up. Thanks.
    Participant
    May 8, 2008
    Also, I've run other CFM files for <cfmail> outputs for forward to friend functions and they have worked fine. This form and the output are just much more complex than anything I have dealt with before.

    Right now I'm not getting any errors it's just not giving the output for the statement when everything is true.

    Thanks.
    Participant
    May 8, 2008
    After I cleared the private data out of the browser it is no longer giving an error message. But it doesn't display the output; of the form being true. Earlier, the message I received stated that the variables were declared incorrectly....something to the effect of that they were declared as java.something.something. Sorry, I didn't save it and now it's not giving the error.

    Also, I noticed that I didn't close the opening <div> tag in the coldfusion output.

    Any suggestions are welcome.
    Inspiring
    May 8, 2008
    Cold Fusion error messages often provide very good hints as to what is wrong. What does yours say?