Validate "numeric" for cfinput does not work with $
I noticed a strange behavior with ColdFusion 9 and maybe earlier versions where using the validate attribute set to numeric will not show an error with a $ in the input. All three validations, onBlur, onSubmit, and onServer allow a input value to contain a $ in the text field. Is this by design and am I misunderstanding something? I tested the same thing in Railo 3.1 and the validation showed an error when I submitted a $ sign in the input. I did learn that Railo does not allow for the validateAt attribut with the input tag and defaults to onSubmit validation, but the validate="numeric" did properly work when submitting the form. A bug?
Comments
@James - I honestly don't know why I have not been using this for client side validation. I plan to try it out on my next form as it makes sense to go this route and also seems much more flexible.
I stopped using CFINPUT back in CF4. I'm now using the jQuery Validation script. I can validation on fields based on other field & element criteria; filled, unchecked, blank, visible, ajax, custom, etc. Another perk, is that I don't have to wait or hope that Railo or Adobe will post a patch to update their proprietary validation scripts. http://docs.jquery.com/Plugins/validation You can also write your own validation expressions. The other great thing about using jQuery Validation is that your non-CF form will work when hosted on different hosting environments... even ones that don't support CFINPUT.