We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now


Coldfusion server side validation decimal-number

Medium Priority
Last Modified: 2013-12-20
Hello experts.
I need help to validate a textfield and allow number with decimals without using jacascript.The code below is validating if it is a anumber with postive values but it does not allow decimal values(f.e 12,25).
Any help to fix this?
<cfif Form.Submitted EQ 1>
  <cfif Form.Prozent NEQ "">
  <cfif NOT IsNumeric(Form.Prozent) OR   Form.Prozent LTE 0>
    <cfset errors = errors & "Bitte eine postive Nummer  ins Prozent-Feld eingeben! (z.B 12,50)<br>">
    <cfset ProzentError = 1>
<input name="prozent" type="text" <cfif ProzentError EQ 1> class="textfieldprozentwarn"<cfelse>class="textfieldprozent" </cfif> id="prozent" maxlength="5"  value="<cfoutput>#Form.Prozent#</cfoutput>"/>
<input  name="INSERT" type="submit">
                       <input  name="submitted" type="hidden" value="1" />

Open in new window

Watch Question

Dear panosms,

check out the ColdFusion Function LSParseNumber ( http://livedocs.adobe.com/coldfusion/6.1/htmldocs/functa38.htm ) as you are trying to input german numeric values.

This should work.
Hope that helps.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts


On this site:http://tutorial201.easycfm.com/
i found a tag named ListValueCount.I have not make it work yet.
I will try it tomorrow again.Can you take a look too?


Hi eclipse2k.
I will keep the 34.34 format.
So i don't need the german numeric values.
Thank you for your help.


thank you again
Hey panosms,

The Function (not a tag) named "ListValueCount" is a basic ColdFusion tag, you can find more information here: http://livedocs.adobe.com/coldfusion/6.1/htmldocs/functb22.htm

which ColdFusion version are you using? I don't see any problems using that function.

Please note that the tutorial at the page you mentioned above is very old (2003) and the technique used is old too, as it was designed for ColdFusion versions prior to 6.1. When you are using a modern ColdFusion version like MX 7 oder CF 8, you should check out this much more advanced techniques:




Hi eclipse2k:
I had two problems.The first to allow only postive number values without any , or .
and the other to allow positive numbers that allow (,) and not (.)
so for the first i find out that the code that is checking what i want is:
<cfif NOT IsNumeric(Form.Test) OR NOT IsValid('integer',Form.Test) OR   Form.Test LTE 0>
    <cfset errors = errors & "....blabla....">
    <cfset TestError = 1>
For the second i decided to use the format with a (.) as i saw that the IsNumeric format ia checking this.
I did not find out how to check how many decimals to allow.
Well if you want to make a comment about all these i would be very happy.!!
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.