> Hi,
> The snippet below does check to ensure that a user puts in a digit in a
> form.
> The problem is - if I test this code like adding a letter to the digit
> it does not flag the error.
> I will like to ensure that only digits are allowed and if anyone as much
> as adds a digit after or before -
> an error will be raised!
> Any bright ideas?

>       <cfif NOT ReFind("[0-9]", form.job_amount,"True")>
>               <cfset error_message = "You must enter a number in the
> amount field.">
>               <cfset error_fields = ListAppend(error_fields,
> "job_amount")>
>               <cfset OK = FALSE>
>       </cfif>

You're wanting to validate monetary values people are assigning to jobs? ...
The issue you're having is that you're going about validation in reverse --
you want to ensure that the field contains no non-numeric values, rather
than ensuring that it contains numeric values as above... so... I would
probably use this as being the simplest solution (doesn't even require any
regex):

<cfif not isnumeric(form.job_amount)>
        <cfset error_message = "blah blah...">
</cfif>

Isaac Dealey
Certified Advanced ColdFusion Developer

www.turnkey.to
954-776-0046
______________________________________________________________________
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to