Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.
-
sviolet #1
cfif statment logic
I am having a problem with cfif statment logic.
If user selects more than 1 checkboxe, my statement doesn't work (nothing is
displayed on action page). If user selects one checkbox, then statement works
(correct fields are displayed). I have 19 checkboxes the user could possibly
select.(i only posted 2 as an example, as nobody was to read through that much
code).
I need the appropriate fields to be displayed on the action page, based on the
checkboxes selected, that's all. How do I deal with represent the results of
mutiple checkboxes.
FORM PAGE
<input type="checkbox" name="INSTREAM_TYPE" value="1">Culvert<br>
<input type="checkbox" name="INSTREAM_TYPE" value="2">Clear-span bridge<br>
ACTION PAGE
<cfif #form.INSTREAM_TYPE# IS 1>
<table>
<tr>
<tr>Culvert<br><input type="Hidden" name="INSTREAM_TYPE" value="1"><br><br>
Culvert Type:<INPUT NAME="CULVERT_TYPE" Size="20"><br>
Culvert Material:<INPUT NAME="CULVERT_MATERIAL" Size="20"><br>
Culvert Length (m):<INPUT NAME="FEATURE_LENGTH" Size="20"><br>
Impact Length (m): <INPUT NAME="IMPACT_LENGTH" Size="20"><br>
Impact Description : <INPUT NAME="IMPACT_DESCRIPTION" Size="45"><br>
Comments:<INPUT NAME="COMMENT" Size="45"></td>
</tr></table>
<!--- if clear span bridge is selected--->
</cfif>
<cfif #form.INSTREAM_TYPE# IS 2>
<table><tr>
<tr>Clear-span bridge<br><input type="Hidden" name="INSTREAM_TYPE"
value="2"><br><br>
Length (m):<INPUT NAME="FEATURE_LENGTH" Size="20"><br>
Impact Length (m): <INPUT NAME="IMPACT_LENGTH" Size="20"><br>
Impact Description : <INPUT NAME="IMPACT_DESCRIPTION" Size="45"><br>
Comments:<INPUT NAME="COMMENT" Size="45"></td>
</tr></table>
</cfif>
sviolet Guest
-
<CFIF> Logic & User Interface
Hi, Everything works as far as fetching the data... This template accepts FORM field submission and hard coded URL's from a search page, and... -
Using an IF statment within an ItemTemplate
Hello, I have a datagrid listing bill to addresses. One column specifies whether or not the bill to is the primary for the customer. Here's my... -
For Statment question
Ok I've got a For statement that works fine but I need to put a variable in the end_condition for (i=1; i< =_root.totalimages; i++) {... -
how to tidy this if statment
on facie if redcounter = -2 then set the member of sprite(2) to member ("unhO") moodget2 = getat(mood, 5) else if redcounter = -1 then set the... -
help with where criteria in sql statment
hi i have an sql statment that is run in excelwhich works fine but if i want to change the where criteria of the statment i have to go into the... -
The ScareCrow #2
Re: cfif statment logic
Because the checkboxes have the same same when a user selects more than one,
the form value is a list.
So if the user selects checkboxes "1, 5, 7"
Then when the form is submitted the variable
#form.INSTREAM_TYPE# will equal "1,5,7"
Thus your cfif will fail
You need to do
<cfif ListContains(form.INSTREAM_TYPE, 1) Is Not 0>
blah..............
<cfelseif ListContains(form.INSTREAM_TYPE, 2) Is Not 0>
blah....blah...
</cfif>
Ken
The ScareCrow Guest
-



Reply With Quote

