2
0

Zend_Validate-Alpha.xml 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- Reviewed: no -->
  3. <sect2 id="zend.validate.set.alpha">
  4. <title>Alpha</title>
  5. <para>
  6. <classname>Zend_Validate_Alpha</classname> allows you to validate if a given value contains
  7. only alphabetical characters. There is no length limitation for the input you want to
  8. validate. This validator is related to the <classname>Zend_Validate_Alnum</classname>
  9. validator with the exception that it does not accept digits.
  10. </para>
  11. <sect3 id="zend.validate.set.alpha.options">
  12. <title>Supported options for Zend_Validate_Alpha</title>
  13. <para>
  14. The following options are supported for <classname>Zend_Validate_Alpha</classname>:
  15. </para>
  16. <itemizedlist>
  17. <listitem>
  18. <para>
  19. <emphasis><property>allowWhiteSpace</property></emphasis>: If whitespace
  20. characters are allowed. This option defaults to <constant>FALSE</constant>
  21. </para>
  22. </listitem>
  23. </itemizedlist>
  24. </sect3>
  25. <sect3 id="zend.validate.set.alpha.basic">
  26. <title>Basic usage</title>
  27. <para>
  28. A basic example is the following one:
  29. </para>
  30. <programlisting language="php"><![CDATA[
  31. $validator = new Zend_Validate_Alpha();
  32. if ($validator->isValid('Abcd')) {
  33. // value contains only allowed chars
  34. } else {
  35. // false
  36. }
  37. ]]></programlisting>
  38. </sect3>
  39. <sect3 id="zend.validate.set.alpha.whitespace">
  40. <title>Using whitespaces</title>
  41. <para>
  42. Per default whitespaces are not accepted because they are not part of the alphabet.
  43. Still, there is a way to accept them as input. This allows to validate complete
  44. sentences or phrases.
  45. </para>
  46. <para>
  47. To allow the usage of whitespaces you need to give the
  48. <property>allowWhiteSpace</property> option. This can be done while creating an instance
  49. of the validator, or afterwards by using <methodname>setAllowWhiteSpace()</methodname>.
  50. To get the actual state you can use <methodname>getAllowWhiteSpace()</methodname>.
  51. </para>
  52. <programlisting language="php"><![CDATA[
  53. $validator = new Zend_Validate_Alpha(array('allowWhiteSpace' => true));
  54. if ($validator->isValid('Abcd and efg')) {
  55. // value contains only allowed chars
  56. } else {
  57. // false
  58. }
  59. ]]></programlisting>
  60. </sect3>
  61. <sect3 id="zend.validate.set.alpha.languages">
  62. <title>Using different languages</title>
  63. <para>
  64. When using <classname>Zend_Validate_Alpha</classname> then the language which the user
  65. sets within his browser will be used to set the allowed characters. This means when your
  66. user sets <emphasis>de</emphasis> for german then he can also enter characters like
  67. <emphasis>ä</emphasis>, <emphasis>ö</emphasis> and <emphasis>ü</emphasis> additionally
  68. to the characters from the english alphabet.
  69. </para>
  70. <para>
  71. Which characters are allowed depends completly on the used language as every language
  72. defines it's own set of characters.
  73. </para>
  74. <para>
  75. There are actually 3 languages which are not accepted in their own script. These
  76. languages are <emphasis>korean</emphasis>, <emphasis>japanese</emphasis> and
  77. <emphasis>chinese</emphasis> because this languages are using an alphabet where a
  78. single character is build by using multiple characters.
  79. </para>
  80. <para>
  81. In the case you are using these languages, the input will only be validated by using
  82. the english alphabet.
  83. </para>
  84. </sect3>
  85. </sect2>
  86. <!--
  87. vim:se ts=4 sw=4 et:
  88. -->