validating (string) === '' (instead === ''), as on ajax commit no yet set inputs are returned as null instead of ''

This commit is contained in:
Ralf Becker 2010-07-13 20:48:08 +00:00
parent a63134dd5f
commit 7938d255b1

View File

@ -2165,7 +2165,7 @@ class etemplate extends boetemplate
case 'text':
case 'textarea':
case 'colorpicker':
if ($value === '' && $attr['needed'] && !$attr['blur'])
if ((string)$value === '' && $attr['needed'] && !$attr['blur'])
{
self::set_validation_error($form_name,lang('Field must not be empty !!!'),'');
}
@ -2190,7 +2190,7 @@ class etemplate extends boetemplate
}
elseif ($type == 'int' || $type == 'float') // cast int and float and check range
{
if ($value !== '' || $attr['needed']) // empty values are Ok if needed is not set
if ((string)$value !== '' || $attr['needed']) // empty values are Ok if needed is not set
{
$value = $type == 'int' ? (int) $value : (float) str_replace(',','.',$value); // allow for german (and maybe other) format