File: Zend_Validate-Alpha.xml

package info (click to toggle)
zendframework 1.12.9%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 133,584 kB
  • sloc: xml: 1,311,829; php: 570,173; sh: 170; makefile: 125; sql: 121
file content (104 lines) | stat: -rw-r--r-- 3,843 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<?xml version="1.0" encoding="UTF-8"?>
<!-- Reviewed: no -->
<sect2 id="zend.validate.set.alpha">
    <title>Alpha</title>

    <para>
        <classname>Zend_Validate_Alpha</classname> allows you to validate if a given value contains
        only alphabetical characters. There is no length limitation for the input you want to
        validate. This validator is related to the <classname>Zend_Validate_Alnum</classname>
        validator with the exception that it does not accept digits.
    </para>

    <sect3 id="zend.validate.set.alpha.options">
        <title>Supported options for Zend_Validate_Alpha</title>

        <para>
            The following options are supported for <classname>Zend_Validate_Alpha</classname>:
        </para>

        <itemizedlist>
            <listitem>
                <para>
                    <emphasis><property>allowWhiteSpace</property></emphasis>: If whitespace
                    characters are allowed. This option defaults to <constant>FALSE</constant>
                </para>
            </listitem>
        </itemizedlist>
    </sect3>

    <sect3 id="zend.validate.set.alpha.basic">
        <title>Basic usage</title>

        <para>
            A basic example is the following one:
        </para>

        <programlisting language="php"><![CDATA[
$validator = new Zend_Validate_Alpha();
if ($validator->isValid('Abcd')) {
    // value contains only allowed chars
} else {
    // false
}
]]></programlisting>
    </sect3>

    <sect3 id="zend.validate.set.alpha.whitespace">
        <title>Using whitespaces</title>

        <para>
            Per default whitespaces are not accepted because they are not part of the alphabet.
            Still, there is a way to accept them as input. This allows to validate complete
            sentences or phrases.
        </para>

        <para>
            To allow the usage of whitespaces you need to give the
            <property>allowWhiteSpace</property> option. This can be done while creating an instance
            of the validator, or afterwards by using <methodname>setAllowWhiteSpace()</methodname>.
            To get the actual state you can use <methodname>getAllowWhiteSpace()</methodname>.
        </para>

        <programlisting language="php"><![CDATA[
$validator = new Zend_Validate_Alpha(array('allowWhiteSpace' => true));
if ($validator->isValid('Abcd and efg')) {
    // value contains only allowed chars
} else {
    // false
}
]]></programlisting>
    </sect3>

    <sect3 id="zend.validate.set.alpha.languages">
        <title>Using different languages</title>

        <para>
            When using <classname>Zend_Validate_Alpha</classname> then the language which the user
            sets within his browser will be used to set the allowed characters. This means when your
            user sets <emphasis>de</emphasis> for german then he can also enter characters like
            <emphasis>ä</emphasis>, <emphasis>ö</emphasis> and <emphasis>ü</emphasis> additionally
            to the characters from the english alphabet.
        </para>

        <para>
            Which characters are allowed depends completly on the used language as every language
            defines it's own set of characters.
        </para>

        <para>
            There are actually 3 languages which are not accepted in their own script. These
            languages are <emphasis>korean</emphasis>, <emphasis>japanese</emphasis> and
            <emphasis>chinese</emphasis> because this languages are using an alphabet where a
            single character is build by using multiple characters.
        </para>

        <para>
            In the case you are using these languages, the input will only be validated by using
            the english alphabet.
        </para>
    </sect3>
</sect2>
<!--
vim:se ts=4 sw=4 et:
-->