User tests: Successful: Unsuccessful:
Pull Request for Issue #12072 .
Replaced the line
if ($required)
{
// If the field is required and the value is empty return an error message.
if (($value === '') || ($value === null))
with if ($required && !$value)
prevents waring "Field required" even when the field is filled.
No
| Status | New | ⇒ | Pending |
| Category | ⇒ | Libraries |
I'd say there is something wrong in your component since it works fine for core apparently. I also can't explain why it works with your code.
What is the value you see in your extension at that point?
So for some reason your code is matching the $value === '' do a var_dump on the $value var at this point to see what it is containing and type or pause it here in the debugger all you are doing is removing a testing constraint which should be perfectly valid.
I'm closing this PR as it is a wrong fix.
If you cna show that it doesn't work with core extension or can provide the code that fails we can have a look at it again.
| Status | Pending | ⇒ | Closed |
| Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2017-02-04 19:48:46 |
| Closed_By | ⇒ | Bakual | |
| Labels |
Added:
?
|
||
($value === '') || ($value === null)would be correct.!$valuewould return true also for0andfalsewhich could be perfectly valid values. We only need to check for empty strings ornullwhen a field is required.