From b291c0fa5f6c0073b91e8fa25239c356735fb19f Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Tue, 13 Jul 2010 20:48:39 +0000 Subject: [PATCH] validating (string) === '' (instead === ''), as on ajax commit no yet set inputs are returned as null instead of '' --- etemplate/inc/class.etemplate.inc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/etemplate/inc/class.etemplate.inc.php b/etemplate/inc/class.etemplate.inc.php index 07c59dee45..3e8fe7c067 100644 --- a/etemplate/inc/class.etemplate.inc.php +++ b/etemplate/inc/class.etemplate.inc.php @@ -2124,7 +2124,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 !!!'),''); } @@ -2149,7 +2149,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