You could just loop over all form field and test If they are blank.

E.g.

<cfset excludelist="submitbutton,whatever"> <!--- list of fields to exclude
from the check --->
<cfset blank = false>
<cfloop list="#form.fieldnames#" index="field">
<cfif not listfind(excludelist, field)>
        <cfif len(form[field]) is 0>
                <cfset blank = true> 
        <cfelse>
                <cfset blank= false>
        </cfif>
</cfif>

If all the submitted fields are blank, the variable BLANK will be true at
the end, if aven 1 is not blank, it will be false, so you can display your
validation message.

--
Snake

-----Original Message-----
From: Eric J. Hoffman [mailto:[EMAIL PROTECTED] 
Sent: 01 May 2006 00:19
To: CF-Talk
Subject: More of a JS Question/Forms

I know this isn't quite CF, but figure the folks around here have done this
easily.

I have two forms, and I just want to check if no value has been entered in
either form, and pop to tell the user to enter something!  So I can't do a
required field in my validation because they can fill in one of three fields
or more in one form, but not the other.

Anyway, I would check form1 and form2 for no values...I get that, but wonder
how to check for nothing from each form.

Thanks.
--------------------------------------------------------


Eric J. Hoffman
Managing Partner
2081 Industrial Blvd
StillwaterMN55082
mail: [EMAIL PROTECTED]
www: http://www.ejhassociates.com
tel: 651.717.4105
fax: 651.717.4115
mob: 651.245.2717

--------------------------------------------------------

This message contains confidential information and is intended only for
[EMAIL PROTECTED] If you are not cf-talk@houseoffusion.com you
should not disseminate, distribute or copy this e-mail. Please notify
[EMAIL PROTECTED] immediately by e-mail if you have received this
e-mail by mistake and delete this e-mail from your system. E-mail
transmission cannot be guaranteed to be secure or error-free as information
could be intercepted, corrupted, lost, destroyed, arrive late or incomplete,
or contain viruses. Eric J. Hoffman therefore does not accept liability for
any errors or omissions in the contents of this message, which arise as a
result of e-mail transmission. If verification is required please request a
hard-copy version.
--------------------------------------------------------



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:239157
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to