Skip to content

Commit

Permalink
Fix for issue codeigniter4#614 Form validation
Browse files Browse the repository at this point in the history
  • Loading branch information
bytedevzone committed Aug 17, 2017
1 parent cd92762 commit 4aa5251
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,8 @@ nb-configuration.xml
.vscode/

/results/

# eclipse
.settings/
.project
.buildpath
8 changes: 7 additions & 1 deletion system/Validation/Validation.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,14 @@ public function run(array $data = null, string $group = null): bool
{
$rules = explode('|', $rules);
}

$value = $data[$rField] ?? null;

if( !in_array('required', $rules) && ($value === NULL OR $value === '' )){
continue;
}

$this->processRules($rField, $data[$rField] ?? null, $rules, $data);
$this->processRules($rField, $value, $rules, $data);
}

return ! empty($this->errors) ? false : true;
Expand Down

0 comments on commit 4aa5251

Please sign in to comment.