Copy link to clipboard
Copied
I have an issue with a CFIF statement that is driving me nuts. I'm sure it will end up being something stupid, but for now I need some help.
Here is the code:
<cfoutput query="get_procedures">
<tr>
<td>#procedureid#</td>
<td><a href='new-procedure-page-1/?id=#procedureid#'>#procedurename#</a></td>
<td align="center">#proceduretypename#</td>
<td align="center">#name#</td>
<td align="center"></td>
<td align="center">#statusname#</td>
<td>
<img alt="" src="/#application.environment#/assets/Image/copy_24px.png" style="cursor:pointer;" title="Copy Procedure" />
<img alt="" src="/#application.environment#/assets/Image/renew_24px.png" style="cursor:pointer;" title="Renew Procedure" />
<cfif #statusname# neq "Archived">
#statusname#<a href="archive-procedure/?id=#procedureid#"><img alt="" src="/#application.environment#/assets/Image/archive_24px.png" style="cursor:pointer;" title="Archive Procedure" /></a>
</cfif>
</td>
</tr>
</cfoutput>
The issue si with the CFIF statement near the end of the code. If the statusname does not equal "Archived", then it is supposed to display the Archive icon. If it does equal "Archived" then is should not display the icon. If you look at the screenshot, you'll see that the icon is displaying even when the statusname = Archived. Any idea as to why this is not working?
Copy link to clipboard
Copied
I would use
<cfif "#statusname#" neq "Archived">
or
<cfif get_procedures.statusname neq "Archived">
or
Copy link to clipboard
Copied
<cfif trim(lcase(get_procedures.statusname)) neq "archived"> should do it.
I always scope my variables. Queryname, form, url, variables, etc. I also always trim and lcase them, unless they are uuids.
V/r,
^ _ ^
Copy link to clipboard
Copied
This worked like a charm.
Thanks
Copy link to clipboard
Copied
Glad I could be of help.
V/r,
^ _ ^