Join GitHub today
eval->required does not work as expected #3277
While debugging the Catalog I discovered a bug in DataContainer.php on line 226 (trunk):
You check for an empty string to determine whether there has been data entered or not.
Then the user doesn't get any asterisk sign because the default value is 0 instead of ''.
Unfortunately I couldn't find any case where this happens in the core for you to reproduce the issue because whenever you have a field with the definition "int(10) NOT NULL default '0'", you provide a default value so $this->varValue in the DataContainer.php is not empty and obviously this is correct because a value is already chosen even if it hasn't been done by the user.
Do you see the problem? =)
--- Originally created on July 18th, 2011, at 02:00pm (ID 3277)
This would be my proposal how we could solve this problem backwards compatible. This way we leave it to the developer to tell the core when the widget is empty or not.
--- Originally created on July 22nd, 2011, at 11:04am
Hmm, the integer 0 would still fail, because strlen(0) returns 1. Any idea for this?
--- Originally created on July 29th, 2011, at 01:36pm
This is correct. If you enter 0, you have entered something and thus the field is not mandatory anymore. In contrast,
--- Originally created on July 29th, 2011, at 03:13pm