diff options
Diffstat (limited to 'src/App.php')
-rw-r--r-- | src/App.php | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/App.php b/src/App.php index a155017..1a12f6a 100644 --- a/src/App.php +++ b/src/App.php @@ -257,9 +257,14 @@ class App */ public function validateSingleField($field) { + $value = $_POST[$field['name']] ?? ''; $field['is_valid'] = true; - if (($field['required'] ?? false) && empty($_POST[$field['name']])) { + if (isset($field['required']) && empty($value)) { + $field['is_valid'] = false; + } + + if (isset($field['validation']['pattern']) && preg_match_all('/' . $field['validation']['pattern'] . '/', $value) === 0) { $field['is_valid'] = false; } |