But when you have a german user then he will enter "1.000,50"
Your server is configured to english and accepts only "1,000.50"

So whatever your user enters, it does not validate because you expect
always english regardless of what the user really does and where he
lives.

Your expectation of "native integer" does not work when you have a
application which is accessed from users all around the world.

Thomas, this sounds like a job for a pre-filter, not the validator.

A true integer has *no* punctuation. You can throw a Digits filter into
the form, and then run an Int validator to validate. The representation
provided back to the user should be part of the decorator and/or view
output -- not the validation logic itself.

I'm really thinking at this point it makes most sense to simply document
strategies for validating localized user input instead of building this
into the validators themselves.

This does not work...

Let's say your user has a input form.
He enters "1,000.50"
Now you want to validate if the entered value is a integer.
Applying a digit filter as you wrote would return 100050 which itself is a integer BUT the entered value is not a integer. So the validator would return true instead of false.

The point is the a filter is applied regardless of the input.
The other point is that it could be, independently of Zend_Form, someone wants to use the Int validator and do something different when the value is not a integer... when you must apply a filter before working with the validator then this would complicate things.

For me the question is:
Do we no longer want to provide locale aware validation ?
We would then have to delete this feature from all validators... it's not only Int. Which itself is a BC break as this feature was available since 1.1/1.5 ?

Or is the issue only regarding the cache problem ?
This can be fixed.

So:
Is the validation itself wrong ? Does it not work ?
Or has Sasa only the cache problem.

----- Original Message ----- From: "Jason Webster" <ja...@intraffic.net>
To: "Zend Framework - General" <fw-general@lists.zend.com>
Sent: Tuesday, June 23, 2009 6:02 PM
Subject: Re: [fw-general] Strange Zend_Form cache problem, please URGENT


Well, I don't think that should apply, though.

Validate_Int implies that you are validating to the native int
datatype, not a currency. Perhaps some of this functionallity should be
split into a Zend_Validate_Currency.

On 23/06/2009 8:55 AM, Jurian Sluiman wrote:
Well in GB one thousand is 1,000 and the floating point is a dot
(0.20ct). In The Netherlands it's exactly the opposite: €10.000,00 is
correct. So where 1.000 in GB is *not* an integer, in The Netherlands it
is.

R, Jurian
--
Jurian Sluiman
Soflomo.com


Op Tuesday 23 June 2009 17:42:57 schreef umpirsky:
 > Yes, i know that, but integer is integer, why use locale at all.
Integer is
 > integer in USA and in Serbia :) For instance Zend_Validate_Alnum
is not
> using it, then I don't see why Zend_Validate_Int use it, but it looks
that
 > for some locale value 5,25 is valid integer, which is also wired.
 >
 > I'm using ZF 1.8.1.
 >
 > Again big thanks for your valuable help.
 >
 > Regards,
 > Sasa Stamenkovic.


--
Matthew Weier O'Phinney
Project Lead            | matt...@zend.com
Zend Framework          | http://framework.zend.com/

Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com

Reply via email to