Ask a Question related to Macromedia ColdFusion, Design and Development.
-
ford007 #1
CFIF Statement problems
I am trying to write a cfif statement, which shows a form only if the statemnt
acts true. It is a 3 part statement, the first two parts appear to work fine,
but the final part does not. I only want the statement to be true if the
Session.MM_Username is equal to the field task.allocation1. The code is as
below hopefully someone can help me please!??? Thanks in advance <cfif
(#task.completeown# EQ 1) AND (#task.completeass# EQ 0) AND
(#Session.MM_username# EQ #task.allocation1#)> <form method='post' name='form3'
action='<cfoutput>#CurrentPage#</cfoutput>'> <h5><font face='Arial, Helvetica,
sans-serif'> Click here to confirm task as complete:</font></h5> <table
align='center'><tr valign='baseline'><td nowrap align='right'>&nbsp;</td>
<td><input type='submit' value='Task Complete'></td> </tr> </table> <input
type='hidden' name='MM_UpdateRecord' value='form3'> <input type='hidden'
name='tasknum' value='<cfoutput>#task.tasknum#</cfoutput>'> <input
type='hidden' name='completeass' value='1' <cfif (#task.completeass# EQ
1)>checked</cfif>> </form></cfif>:beer;
ford007 Guest
-
Repeating output with cfif statement
I have a problem when multiple checkboxes are "turned on' when multiple values exist for a field in a database. For example: The following code... -
Help with cfif statement
Can anyone help me find the correct way to write the following statement? <cfif form.user2 NEQ 15 or 50 or 51 or 52 or 53 or 55 or 200 or 223 or... -
Dymanic Query and CFIF Problems
Problem: I have an application where I have one access table with the following fields: autonum, cca_index, cca_category, wt_index, wt_category. ... -
Login error with CFIF statement
Hi all: I'm having trouble with a login CFIF routine. The following code works fine when the login is TRUE, but when I try to login with invalid... -
Using cfoutput within a cfif statement
I am trying to setup a form validation, what i need to do is look at the Specimen Number entered and compare it against the database to see if it... -
jdeline #2
Re: CFIF Statement problems
First off, you can simplify your CFIF statement - see below. That probably
doesn't solve your problem, but it makes your code more readable.
<cfif task.completeown EQ 1 AND ask.completeass EQ 0 ANDSession.MM_username EQ
task.allocation1>
jdeline Guest
-
Adam Cameron #3
Re: CFIF Statement problems
> First off, you can simplify your CFIF statement - see below. That probably
And if task.completeown and ask.completeass are boolean values (ie: either> doesn't solve your problem, but it makes your code more readable.
>
> <cfif task.completeown EQ 1 AND ask.completeass EQ 0 ANDSession.MM_username EQ
> task.allocation1>
1 or 0), you can further clarify this as:
<cfif task.completeown AND NOT ask.completeass AND Session.MM_username EQ
task.allocation1>
But, back to the problem... you're finding that the Session.MM_username EQ
task.allocation1 expression is returning false? Hmmm. This kinda suggests
that they're not actually the same. You sure one of them doesn't have some
whitespace around the value you're not noticing?
It's also better to use compare() than EQ with strings, but it's not going
to help your situation; just food for thought.
Do this:
<cfoutput>
#task.completeown#<br />
#NOT ask.completeass#<br />
#Session.MM_username EQ task.allocation1#<br />
</cfoutput>
The should all be yes / not-zero / true.
Are they?
--
Adam
Adam Cameron Guest
-
ford007 #4
Re: CFIF Statement problems
sorry bout the late reply, but i try not to work weekends. Err the answers to
the query you asked me to run came out as follows 1 Yes No So it is looking
as if you are correct, and my task.allocation1 and Session.MM_username are not
matching. I will have a look into this. Thanks for your help so far will let
you know how it goes, and if i run into further problems.
ford007 Guest
-
OldCFer #5
Re: CFIF Statement problems
The following cannot work:
<cfif (#task.completeown# EQ 1) AND (#task.completeass# EQ 0) AND
(#Session.MM_username# EQ #task.allocation1#)>
...
<cfif (#task.completeass# EQ 1)>checked</cfif>>
</cfif>
In order to enter the first cfif block #task.completeass# must be 0. How can
it ever be 1 for the "check" value?
What does checking a hidden field do anyway?
OldCFer Guest



Reply With Quote

