Number format validation issues

View: New views
7 Messages — Rating Filter:   Alert me  

Number format validation issues

by Phil Kemp :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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

Re: Number format validation issues

by Jeff Coughlin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


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

On Jul 3, 2009, at 10:25 AM, Phil Kemp wrote:

>
> 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

--~--~---------~--~----~------------~-------~--~----~
You received this message cos you are subscribed to "farcry-dev" Google group.
To post, email: farcry-dev@...
To unsubscribe, email: farcry-dev+unsubscribe@...
For more options: http://groups.google.com/group/farcry-dev
--------------------------------
Follow us on Twitter: http://twitter.com/farcry
-~----------~----~----~----~------~----~------~--~---


Re: Number format validation issues

by Phil Kemp :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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?

Re: Number format validation issues

by Jeff Coughlin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


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

On Jul 6, 2009, at 10:51 AM, Phil Kemp wrote:

>
>
> 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
> Sent from the FarCry - Dev mailing list archive at Nabble.com.
>
>
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message cos you are subscribed to "farcry-dev" Google group.
To post, email: farcry-dev@...
To unsubscribe, email: farcry-dev+unsubscribe@...
For more options: http://groups.google.com/group/farcry-dev
--------------------------------
Follow us on Twitter: http://twitter.com/farcry
-~----------~----~----~----~------~----~------~--~---


Re: Number format validation issues

by Phil Kemp :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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

Re: Number format validation issues

by modius :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Jul 7, 9:17 am, Jeff Coughlin <j...@...> 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/
--~--~---------~--~----~------------~-------~--~----~
You received this message cos you are subscribed to "farcry-dev" Google group.
To post, email: farcry-dev@...
To unsubscribe, email: farcry-dev+unsubscribe@...
For more options: http://groups.google.com/group/farcry-dev
--------------------------------
Follow us on Twitter: http://twitter.com/farcry
-~----------~----~----~----~------~----~------~--~---


Re: Number format validation issues

by Jeff Coughlin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


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/

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

--~--~---------~--~----~------------~-------~--~----~
You received this message cos you are subscribed to "farcry-dev" Google group.
To post, email: farcry-dev@...
To unsubscribe, email: farcry-dev+unsubscribe@...
For more options: http://groups.google.com/group/farcry-dev
--------------------------------
Follow us on Twitter: http://twitter.com/farcry
-~----------~----~----~----~------~----~------~--~---