Solved

Cold Fusion lang question

Posted on 2013-06-11
2
233 Views
Last Modified: 2013-06-18
Hi,
I have this statement which checks to see if anything exists in the  url field.

<cfif len(associate.url)>
## Field has a value in it
</cfif>

How would I check to see if the field IS NOT populated
This:
<cfif ! len(associate.url)>

or
<cfif not len(assicate.url)>

Neither? Both? Something else?
Thanks!
N
0
Comment
Question by:nachtmsk
2 Comments
 
LVL 39

Accepted Solution

by:
gdemaria earned 300 total points
ID: 39238092
<cfif not len(assicate.url)>  -- field has no size

or you can just do..

<cfif  len(assicate.url) eq 0>  --- field is empty


I prefer the above, but you can also test to see if its equal to an empty string

<cfif  assicate.url  is "">
0
 
LVL 52

Assisted Solution

by:_agx_
_agx_ earned 200 total points
ID: 39238226
> Neither? Both? Something else?

Any of the above, incuding gdemaria's example.  They should all do the same thing. So it's a matter of personal preference.

One other thing that may or may not apply here ... if you want to ignore extra white space, like "(space)" or "(multiple spaces)" , trim() the values first.  ie

        <cfif !len(trim(associate.url))>
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article  is about submitting  form through  ColdFusion.Ajax.submitForm to the action page and send a response back in JSON format which later can be decoded using ColdFusion.JSON.decode. By this way you can avoid the usual page refresh for subm…
I spent nearly three days trying to figure out how incorporate OAuth in Coldfusion for the Eventful API. Hopefully, this article will allow Coldfusion Programmers to buzz through the API when they need to. Basically, what this script does is authori…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now