Well, you'll probably need to re-evaluate your form validation for this, but
I would use a regular _expression_:

<cfif not reFind("^[.]*{10,120}$",form.field)>you messed up</cfif>

Look into it more at
http://livedocs.macromedia.com/coldfusion/6.1/htmldocs/regexp.htm

-nathan strutz

  -----Original Message-----
  From: Stuart Kidd [mailto:[EMAIL PROTECTED]
  Sent: Wednesday, March 10, 2004 8:54 AM
  To: CF-Talk
  Subject: cfqueryparam, cfcatch 'n cftry

  Hi guys,

  In my cfcatch i've got a bunch of <cfif>'s checking to make sure all parts
of my form were correct.

  e.g.:

  <cfif form.PropertyDataVillageTown is ""><cfset MessageAlert =
MessageAlert & "<font color='b23f3f'><b>Village/Town</b></font> must have a
value.<br>"><cfset ErrorFound = "yes"></cfif>
  <cfif form.PropertyDataCountyState is ""><cfset MessageAlert =
MessageAlert & "<font color='b23f3f'><b>County/State</b></font> must have a
value.<br>"><cfset ErrorFound = "yes"></cfif>
  <cfif form.PropertyDataPostcodeZip is ""><cfset MessageAlert =
MessageAlert & "<font color='b23f3f'><b>Postcode/Zip</b></font> must have a
value.<br>"><cfset ErrorFound = "yes"></cfif>

  However, all these actions will only take place if there is an error
triggered.

  I have one field which is a description and i'd like to trigger an error
if it is less than 10 characters in length and more than 120.  When i am
using cfqueryparam in my SQL i noticed i can have such a line:

  <cfqueryparam cfsqltype="cf_sql_longvarchar" maxlength="120">

  Will this the right thing to trigger an error in case it's more than 120
characters??  How about if i want to trigger the error if it's less than 10
characters too, can that not be done.

  BTW: i just chucked in that cf_sql_longvarchar because i didn't know what
to use.

  Thanks,

  Stu
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to