Christina,
You are comparing a "string" value to 0 and that will always return false.
For example, you have "RegionalSearch" IS 0. "RegionalSearch" is equal to
RegionalSearch (not the variable, but the actual string). That, of course,
will never equal 0. Also, it looks like you are trying to reference a
variable that does not exist in your form (forecast_bycommunity_form).
Also, you have a hidden form field, "reporttype" that will ALWAYS be 2, so
even if your conditional statement (the cfif/elseif) would have the
variables properly specified, you would never get to Total Forecasted School
Age Population (5-17) by School District, because reporttype will always
equal 2. So even if someone selected that item from your drop down, your
page would still display the Total Forecasted Employment by Community.
Lastly, if you are posting to the same page, then you don't need to specify
the action in <cfform> You can, of course, but if you are really posting to
a different page, then your display code on this page would never be reached
anyway. I'm guessing, but I think this is what you are looking for:
<cfform name="forecast_bycommunity_form" method="post" preservedata="yes">
<div id="search" style="border:1px solid black; padding:10px;
width:230px;">
Regional Search<br /><br />
<cfselect name="RegionalSearch" size="4" style="width:230px">
<option value="0">Total population by Community</option>
<option value="1">Total households by Community</option>
<option value="2">Total employment by Community</option>
<option value="3">School age pop. (5-17) by School
District</option>
</cfselect><br /><br />
<input type="submit" value="Search Data" id="fbc_submit" />
</div>
</cfform>
<cfif isDefined("form.RegionalSearch")>
<div class="title" style="width:890px; text-align:center">
<cfif form.RegionalSearch EQ 0>
Total Forecasted Population by Community
<cfelseif form.RegionalSearch EQ 1>
Total Forecasted Households by Community
<cfelseif form.RegionalSearch EQ 2>
Total Forecasted Employment by Community
<cfelse>
Total Forecasted School Age Population (5-17) by School District
</cfif>
</div>
</cfif>
-----Original Message-----
From: Christina K [mailto:[EMAIL PROTECTED]
Sent: Monday, December 01, 2008 9:03 PM
To: cf-newbie
Subject: Send option value from cfform
I'm having a brain-freeze and I need help. I'm sure this is a small thing
but it's just not coming to me. I've got a form with a cfselect statement.
When one of the options is selected it should submit the value to this file:
regional.forecast.data.cfm. This file should display different tables based
on the selection. I've got several different possibilities in the if
statement below, but none of them are working. Any suggestions would be
appreciated?
<cfform name="forecast_bycommunity_form" method="post"
action="regional.forecast.data.cfm" preservedata="yes">
<div id="search" style="border:1px solid black; padding:10px;
width:230px;">
<input type="hidden" name="reporttype" value="2" />
Regional Search<br /><br />
<cfselect name="RegionalSearch" size="4" style="width:230px">
<option value="0">Total population by Community</option>
<option value="1">Total households by Community</option>
<option value="2">Total employment by Community</option>
<option value="3">School age pop. (5-17) by School
District</option>
</cfselect><br /><br />
<input type="submit" value="Search Data" id="fbc_submit" />
</div>
</cfform>
<div class="title" style="width:890px; text-align:center">
<cfif IsDefined ("RegionalSearch")and "RegionalSearch" Is 0>
Total Forecasted Population by Community
<cfelseif IsDefined ("forecast_bycommunity_form") and
"forecast_bycommunity_form" eq 1>
Total Forecasted Households by Community
<cfelseif IsDefined ("reporttype") and "reporttype" eq 2>
Total Forecasted Employment by Community>
<cfelse>
Total Forecasted School Age Population (5-17) by School
District
</cfif>
</div>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f
Archive:
http://www.houseoffusion.com/groups/cf-newbie/message.cfm/messageid:4203
Subscription: http://www.houseoffusion.com/groups/cf-newbie/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15