Sure, you could add the names to check to a list
I used this to check for required form fields...

You can modify it for your needs

<cfset notRequired =
"sec_level,address2,division,phone_ext,fax_area,fax_prefix,fax_suffix,email_directory,fieldnames"/>

<!--- loop over form fields checking for required fields --->
<cfloop collection="#form#" item="key">
        <cfif not ListFindNoCase(notRequired, key)>
                <cfif len(trim(form[key])) eq 0>
                        <cfset errText = errText & "<div
class='alert'>**<cfoutput>#key#</cfoutput> is required**</div>">
                        <cfset hasErrors = 1 />
                </cfif>
        </cfif>
</cfloop>

On Mon, Jan 24, 2011 at 12:04 PM, Adam Bourg <[email protected]> wrote:
>
>>yeah you can't do that.. gotta do
>>if adultExp gt 60 OR kidExp gt 60 OR ...
>>
>>
>>>
>
> Is there an easier way to do that? Maybe a loop?
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:341140
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to