-- Thomas Weidner <[email protected]> wrote
(on Tuesday, 23 June 2009, 07:47 PM +0200):
> 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.


> ----- Original Message ----- From: "Jason Webster" <[email protected]>
> To: "Zend Framework - General" <[email protected]>
> 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            | [email protected]
Zend Framework          | http://framework.zend.com/

Reply via email to