Skip to content

Commit bd8b728

Browse files
author
Marius Cramer
committed
Added: new validator ISASCII to forbid non-ascii characters
1 parent ea1e356 commit bd8b728

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

interface/lib/classes/tform_base.inc.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -879,6 +879,15 @@ function validateField($field_name, $field_value, $validators) {
879879
}
880880
}
881881
break;
882+
case 'ISASCII':
883+
if(preg_match("/[^\x20-\x7F]/", $field_value)) {
884+
$errmsg = $validator['errmsg'];
885+
if(isset($this->wordbook[$errmsg])) {
886+
$this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
887+
} else {
888+
$this->errorMessage .= $errmsg."<br />\r\n";
889+
}
890+
}
882891
case 'ISEMAIL':
883892
if(function_exists('filter_var')) {
884893
if(filter_var($field_value, FILTER_VALIDATE_EMAIL) === false) {

0 commit comments

Comments
 (0)