>- see footer for list info -<
two ways: 
1. Javascript on the page with the form.  Either use <cfinput
required="yes" message="Please enter your name">, or roll your own. 
Problems - requires Javascript to be enabled in the browser to work, so
disabling javascript gets around the validation.

2. Server-side with validation.  On the page you submit to, have
something like: 
<cfparam name="Form.fieldname1" default="">
<cfparam name="Form.fieldname2" default="">

<cfif NOT Len(Trim(Form.fieldname1))>
  <cflocation url="page1.cfm?error=fieldname1">
</cfif>
<cfif NOT Len(Trim(Form.fieldname2))>
  <cflocation url="page1.cfm?error=fieldname2">
</cfif>


Then on the first page, have something like: 

<cfparam name="URL.error" default="">
<cfif Len(URL.error)>
  <cfswitch expression="#URL.error#">
    <cfcase value="fieldname1">
      You must enter a value for fieldname 1
    </cfcase>
    <cfcase value="fieldname2">
      You must enter a value for fieldname 2
    </cfcase>
  </cfswitch>
</cfif>

Very basic, but gives you an idea of what to do.  Of course I'm
assuming this is why you want to know if the field is empty. 

Duncan Cumming
New Media Developer
700 4105 / 01592 414105 

>>> [EMAIL PROTECTED] 24/11/2004 16:12:10 >>>
>- see footer for list info -<


**********************************************************************
This email and any files transmitted with it are confidential and intended 
solely for the use of the individual or entity to whom they are addressed and 
should not be disclosed to any other party. 
If you have received this email in error please notify your system manager and 
the sender of this message.

This email message has been swept for the presence of computer viruses but no 
guarantee is given that this e-mail message and any attachments are free from 
viruses.

Fife Council
Tel: +44 (0) 1592 414141
**********************************************************************

_______________________________________________

For details on ALL mailing lists and for joining or leaving lists, go to 
http://list.cfdeveloper.co.uk/mailman/listinfo

--
CFDeveloper Sponsors:-
>- Hosting provided by www.cfmxhosting.co.uk -<
>- Forum provided by www.fusetalk.com -<
>- DHTML Menus provided by www.APYCOM.com -<
>- Lists hosted by www.Gradwell.com -<
>- CFdeveloper is run by Russ Michaels, feel free to volunteer your help -<

Reply via email to