| verzia 1.46, 2004/04/04 20:42:35 |
verzia 1.47, 2004/04/12 22:14:41 |
|
|
| <!-- $Platon: phpMyEdit/doc/sgml/configuration.fields.sgml,v 1.45 2004/04/01 10:40:00 nepto Exp $ --> |
<!-- $Platon: phpMyEdit/doc/sgml/configuration.fields.sgml,v 1.46 2004/04/04 20:42:35 nepto Exp $ --> |
| |
|
| <!-- Categories: |
<!-- Categories: |
| |
|
| Riadok 264 All variables in following section shoul |
|
| Riadok 264 All variables in following section shoul |
|
| |
|
| </para> |
</para> |
| |
|
| <bridgehead id="configuration.fields.required">Required fields</bridgehead> |
|
| <para> |
|
| |
|
| By default, JavaScript will be generated to prevent null entries by the user. If |
|
| an entry is not required for a particular field, change the setting to |
|
| <constant>false</constant>. |
|
| |
|
| <example><title>Required fields</title> |
|
| <programlisting><![CDATA[ |
|
| $opts['fdd']['col_name']['required'] = true; |
|
| $opts['fdd']['col_name']['required'] = false; |
|
| ]]></programlisting> |
|
| </example> |
|
| |
|
| </para> |
|
| |
|
| <bridgehead id="configuration.fields.sort">Sorting</bridgehead> |
<bridgehead id="configuration.fields.sort">Sorting</bridgehead> |
| <para> |
<para> |
| |
|
| Riadok 328 $opts['fdd']['col_name']['escape'] = fal |
|
| Riadok 312 $opts['fdd']['col_name']['escape'] = fal |
|
| ]]></programlisting> |
]]></programlisting> |
| </example> |
</example> |
| |
|
| |
</para> |
| |
</sect1> |
| |
|
| |
<sect1 id="configuration.input-validation"> |
| |
<title id="configuration.input-validation.title">Input validation</title> |
| |
<para> |
| |
|
| |
&name; users can benefit also from JavaScript scripting language, when |
| |
validating input values before form is submited. |
| |
|
| |
</para> |
| |
<bridgehead id="configuration.fields.js.required">Required fields</bridgehead> |
| |
<para> |
| |
|
| |
For the most simple validation JavaScript can be generated to prevent null |
| |
entries by the user. If an entry is required for a particular field, set the |
| |
<varname>['js']['required']</varname> option to <constant>true</constant>. |
| |
|
| |
<example><title>Required fields</title> |
| |
<programlisting><![CDATA[ |
| |
$opts['fdd']['col_name']['js']['required'] = true; |
| |
$opts['fdd']['col_name']['js']['required'] = false; |
| |
]]></programlisting> |
| |
</example> |
| |
|
| |
</para> |
| |
<bridgehead id="configuration.fields.js.regexp">Regular expressions</bridgehead> |
| |
<para> |
| |
|
| |
JavaScript regular expressions can be a powerful way to make interactive input |
| |
validation. When used, input must match desired regular expression defined |
| |
in the <varname>$opts['fdd']['col_name']['js']['regexp']</varname>. |
| |
If some field does not match, JavaScript warning will be invoked to force user |
| |
to change entered value. |
| |
|
| |
<example><title>Regular expression example</title> |
| |
<programlisting><![CDATA[ |
| |
$opts['fdd']['col_name']['js']['regexp'] = '/^[0-9]*$/'; |
| |
]]></programlisting> |
| |
</example> |
| |
|
| |
</para> |
| |
<para> |
| |
|
| |
Regular expression are written in Perl compatible style. An expression above |
| |
allows form to submit only when digit/number characters are entered in the |
| |
field. Empty value is also allowed, but you can use |
| |
<varname>['js']['regexp']</varname> in combination with |
| |
<varname>['js']['required']</varname> to prevent empty entries. |
| |
|
| |
</para> |
| |
<bridgehead id="configuration.fields.js.hint">Hints</bridgehead> |
| |
<para> |
| |
|
| |
When <varname>['js']['required']</varname> option is used and entered value is |
| |
empty, or field does not match defined <varname>['js']['regexp']</varname>, |
| |
a warning with default message is printed. Such message can be changed. |
| |
This is especially useful when regular expression for checking input fields is |
| |
used and we want to advice user how entered value might look like. |
| |
|
| |
<example><title>JavaScript hint</title> |
| |
<programlisting><![CDATA[ |
| |
$opts['fdd']['col_name']['js']['hint'] |
| |
= 'Please enter only numbers in the "col_name" field.'; |
| |
]]></programlisting> |
| |
</example> |
| |
|
| </para> |
</para> |
| </sect1> |
</sect1> |
| |
|