From f873d44ded59647cbf6a639389793806c1969c5b Mon Sep 17 00:00:00 2001 From: thomas Date: Wed, 28 Apr 2010 19:23:47 +0000 Subject: [PATCH] [ZF-8972] Zend_Validate: - added section for Zend_Validate_Float git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@22040 44c647ce-9c0f-0410-b52a-842ac1e357ba --- .../manual/en/module_specs/Zend_Validate-Float.xml | 85 ++++++++++++++++++++++ .../manual/en/module_specs/Zend_Validate-Set.xml | 14 +--- 2 files changed, 86 insertions(+), 13 deletions(-) create mode 100644 documentation/manual/en/module_specs/Zend_Validate-Float.xml diff --git a/documentation/manual/en/module_specs/Zend_Validate-Float.xml b/documentation/manual/en/module_specs/Zend_Validate-Float.xml new file mode 100644 index 000000000..334807ddb --- /dev/null +++ b/documentation/manual/en/module_specs/Zend_Validate-Float.xml @@ -0,0 +1,85 @@ + + + + Float + + + Zend_Validate_Float allows you to validate if a given value contains + a floating-point value. This validator validates also localized input. + + + + Supported options for Zend_Validate_Float + + + The following options are supported for Zend_Validate_Float: + + + + + + locale: Sets the locale which will be + used to validate localized float values. + + + + + + + Simple float validation + + + The simplest way to validate a float is by using the system settings. When no option + is used, the environment locale is used for validation: + + + isValid(1234.5); // returns true +$validator->isValid('10a01'); // returns false +$validator->isValid('1,234.5'); // returns true +]]> + + + In the above example we expected that our environment is set to "en" as locale. + + + + + Localized float validation + + + Often it's useful to be able to validate also localized values. Float values are often + written different in other countries. For example using english you will write "1.5". + In german you may write "1,5" and in other languages you may use grouping. + + + + Zend_Validate_Float is able to validate such notations. But it is + limited to the locale you set. See the following code: + + + 'de')); + +$validator->isValid(1234.5); // returns true +$validator->isValid("1 234,5"); // returns false +$validator->isValid("1.234"); // returns true +]]> + + + As you can see, by using a locale, your input is validated localized. Using a different + notation you get a FALSE when the locale forces a different + notation. + + + + The locale can also be set afterwards by using setLocale() and + retrieved by using getLocale(). + + + + diff --git a/documentation/manual/en/module_specs/Zend_Validate-Set.xml b/documentation/manual/en/module_specs/Zend_Validate-Set.xml index 3523a9f6a..06d567a4a 100644 --- a/documentation/manual/en/module_specs/Zend_Validate-Set.xml +++ b/documentation/manual/en/module_specs/Zend_Validate-Set.xml @@ -43,19 +43,7 @@ - - - Float - - - Returns TRUE if and only if $value is a - floating-point value. Since Zend Framework 1.8 this validator takes into account the - actual locale from browser, environment or application wide set locale. You can of - course use the get/setLocale accessors to change the used locale or give it while - creating a instance of this validator. - - - + -- 2.11.4.GIT