diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 94cb20fafaa1f..8f196c85eab71 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -374,8 +374,10 @@ function textwithtooltip($text, $htmltext, $tooltipon = 1, $direction = 0, $img
if ($direction < 0) $s.='<'.$tag.$paramfortooltipimg.' valign="top" width="14">'.$img.''.$tag.'>';
if ($text != '')
{
- $s.='<'.$tag.$paramfortooltiptd.'>'.$text;
- if ($direction) $s.=' ';
+ $s.='<'.$tag.$paramfortooltiptd.'>';
+ if ($direction < 0) $s.=' ';
+ $s.=$text;
+ if ($direction > 0) $s.=' ';
$s.=''.$tag.'>';
}
if ($direction > 0) $s.='<'.$tag.$paramfortooltipimg.' valign="top" width="14">'.$img.''.$tag.'>';