[farcry-dev] Number format validation issues

5 views
Skip to first unread message

Phil Kemp

unread,
Jul 3, 2009, 10:25:09 AM7/3/09
to farcr...@googlegroups.com

Greetings,

I have a custom type with a numeric data type as defined below:

<cfproperty ftSeq="412" ftWizardStep="EC" ftFieldSet="EC" ftLabel="Estimated
EC Contribution" default="" hint="Est. EC Contribution"
name="est_ec_contrib" type="numeric" ftValidation="validate-number" />

Each time I load the editing page for this field, it sets the value to
"0,00". As you can see, that's a number. However, it's not a number
according to the validation rule which doesn't take into account spaces or
the comma instead of a full stop (or period for you Americans) as a decimal
separator.

I therefore would like to know two things:
- How easy would it be to alter the validation script to accept spaces and ,
instead of .
- and, Why is it every time I load that wizard page it defaults to a value
that won't pass the validation - what can I do to stop this?

Cheers,
-Phil

--
View this message in context: http://www.nabble.com/Number-format-validation-issues-tp24323966s621p24323966.html
Sent from the FarCry - Dev mailing list archive at Nabble.com.

Jeff Coughlin

unread,
Jul 3, 2009, 11:43:18 AM7/3/09
to farcr...@googlegroups.com
Phil,

Not sure if these will help, but maybe try setting ftDefault="0" (or
"0.00"). If that doesn't work, try ftIncludeDecimal="true". And if a
whole integer is what you'd prefer, try ftType="integer".

Regards,

--
Jeff Coughlin
Web Application Developer
http://jeffcoughlin.com

Phil Kemp

unread,
Jul 6, 2009, 10:51:41 AM7/6/09
to farcr...@googlegroups.com

Jeff,

ftIncludeDecimal="true" only solved a small part of this.

In the database I have the value "3000000" which is being displayed by the
form as "3,000,000" - and that, coupled with validate-number crashes as a
comma isn't a number.

How can I stop it automatically formatting the number?
OR
Is the a better validation method I can use?
--
View this message in context: http://www.nabble.com/Number-format-validation-issues-tp24323966s621p24356755.html

Jeff Coughlin

unread,
Jul 6, 2009, 7:17:19 PM7/6/09
to farcr...@googlegroups.com
Phil,

I'm not sure. It's probably a limitation of the javascript validator
in FarCry.

In my opinion the javascript validator was really cool when first
introduced, but FarCry has already advanced farther than the current
js validator solution can keep up with. Granted, you can override the
validation in FarCry using custom methods (I'm not sure if it's
documented, but Mat showed me once and it was pretty cool, albeit a
little complicated), however I'm curious if anyone would be interested
in replacing the js validation scripts in FarCry with the following
jQuery plugin written by one of the jQuery team members http://bassistance.de/jquery-plugins/jquery-plugin-validation/
(Documentation here: http://docs.jquery.com/Plugins/Validation).
I've been using it for a few months in some other projects (non-FarCry
apps) and it's pretty powerful (and extremely easy to implement and
customize).

If interested in the plugin, maybe first take a look at Ray Camden's
experience/tutorials of using the jQuery plugin. It demonstrates how
easily we could customize it to be used with different ftTypes and
even offer things like custom error messages (note: This is actually a
3-part series he wrote. The first part is meant to be simple and
limited to help introduce the plugin before he gets into more
complicated solutions. He even has a few posts he wrote not labeled
as part of the series which talks about using the plugin to do even
more form validation not previously described in the series: http://www.coldfusionjedi.com/index.cfm/2009/2/9/An-introduction-to-jQuery-and-Form-Validation)
.

Thoughts anyone?...

If I raised this as a feature request in the bug tracker, would people
vote for it, or am I just pushing jQuery plugins on people
again :) ? (I've been known to do that the past several months ever
since I got hooked on jQuery).

--
Jeff Coughlin
Web Application Developer
http://jeffcoughlin.com

Phil Kemp

unread,
Jul 7, 2009, 7:45:14 AM7/7/09
to farcr...@googlegroups.com

Bingo!

There's an attribute that isn't in the documentation (but is now thanks to
my comment)

ftMask

My default was treating this as "999,999,999" so I sent this attribute as
"999999999" and all works fine
--
View this message in context: http://www.nabble.com/Number-format-validation-issues-tp24323966s621p24371816.html

modius

unread,
Jul 8, 2009, 4:35:03 AM7/8/09
to farcry-dev
On Jul 7, 9:17 am, Jeff Coughlin <j...@jeffcoughlin.com> wrote:
> In my opinion the javascript validator was really cool when first  
> introduced, but FarCry has already advanced farther than the current  
> js validator solution can keep up with.  Granted, you can override the  
> validation in FarCry using custom methods (I'm not sure if it's  
> documented, but Mat showed me once and it was pretty cool, albeit a  
> little complicated), however I'm curious if anyone would be interested  
> in replacing the js validation scripts in FarCry with the following  
> jQuery plugin written by one of the jQuery team membershttp://bassistance.de/jquery-plugins/jquery-plugin-validation/
>   (Documentation here:http://docs.jquery.com/Plugins/Validation).  
> I've been using it for a few months in some other projects (non-FarCry  
> apps) and it's pretty powerful (and extremely easy to implement and  
> customize).

The current FarCry 5.3 roadmap includes a complete overhaul of
formtools to standardise on jQuery (currently FarCry internals are a
mix of extJS, prototype and jQuery). The Gods willing this will
include:

- jquery formtools standardisation (although its likely they will have
a similar look by default)
- a jQuery based validation framework (Jeff's suggested plugin is
under consideration)
- jQueryUI (http://jqueryui.com/) abstraction for theming (at least in
the project, if not the webtop)
- the ability to load and reference your own jQuery library into a
nominated namespace (in case you have jQuery goings on that conflict
with standard FarCry behaviour)
- a new library picker with a variety of skinning and filtering
options

Mat has already pioneered much of this work. With the main code line
clear of 5.2 and barring any last minute road map changes, we should
see these beginnings in trunk by the end of the month.

-- geoff
http://www.daemon.com.au/

Jeff Coughlin

unread,
Jul 8, 2009, 10:33:05 AM7/8/09
to farcr...@googlegroups.com
On Jul 8, 2009, at 4:35 AM, modius wrote:

> The current FarCry 5.3 roadmap includes a complete overhaul of
> formtools to standardise on jQuery (currently FarCry internals are a
> mix of extJS, prototype and jQuery). The Gods willing this will
> include:
>
> - jquery formtools standardisation (although its likely they will have
> a similar look by default)
> - a jQuery based validation framework (Jeff's suggested plugin is
> under consideration)
> - jQueryUI (http://jqueryui.com/) abstraction for theming (at least in
> the project, if not the webtop)
> - the ability to load and reference your own jQuery library into a
> nominated namespace (in case you have jQuery goings on that conflict
> with standard FarCry behaviour)
> - a new library picker with a variety of skinning and filtering
> options


Nice. If interested, here's a really good blog post from w3avenue
(thanks to Hal Helms for the link) regarding a "List of Really Useful
Plugins for jQuery Developers" which also has some form validation
options (I haven't tried them yet though).

http://www.w3avenue.com/2009/07/01/list-of-really-useful-plugins-for-jquery-developers/

Reply all
Reply to author
Forward
0 new messages