Skip to content

Commit

Permalink
[LorisForm] Fixing the loris form '0' emptying issue (#2781)
Browse files Browse the repository at this point in the history
$this->form->addRule("value", "Required", 'required'); sets the 'required fail' when the user submits a value of "0", because empty($value) is true for 0.

This updates the code to explicitly check for the empty string to detect no input, and avoids PHP's empty() function for validation.
  • Loading branch information
sruthymathew123 authored and driusan committed Jun 5, 2017
1 parent 4c33064 commit 0951825
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion php/libraries/LorisForm.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -1180,7 +1180,7 @@ class LorisForm

if (isset($el['required'])
&& $el['required'] === true
&& empty($value)
&& $value === ""
) {
$errors[$el['name']] = "required fail";
}
Expand Down

0 comments on commit 0951825

Please sign in to comment.