phpMyEdit users can benefit also from the JavaScript scripting language, when validating input values before the form is submited.
For the most simple Simple validation JavaScript can be generated to prevent null entries by the user. If an entry is required for a particular field, set the ['js']['required'] option to true.
Example 4-11. Required fields
$opts['fdd']['col_name']['js']['required'] = true; $opts['fdd']['col_name']['js']['required'] = false;
JavaScript regular expressions can be a powerful way to make interactive input
validation. When used, input must match the desired regular expression defined
in the $opts['fdd']['col_name']['js']['regexp'].
If some a field does not match, a JavaScript warning will be invoked to force the user
to change entered value.
??? perhaps alert is better than warning (above) ... maybe more people are familiar with the term "JavaScript alert"
Regular expressions are written in Perl compatible style. An The expression above allows the form to submit only when digit/number numeric characters 0-9 are entered in the field. An empty value is also allowed, but you can use ['js']['regexp'] in combination with ['js']['required'] to prevent empty entries, for example:
$opts['fdd']['col_name']['js']['required'] = true;
When the ['js']['required'] option is used and the value entered is empty, or the field characters entered do does not match the defined ['js']['regexp'], a warning with the default message is printed displayed. Such This message can be changed using ['js']['hint'] . ... [snip] ... This is especially useful for advising the user about field-specific data input restrictions.