View Issue Details

IDProjectCategoryView StatusLast Update
0004505JEDI VCL00 JVCL Componentspublic2008-10-26 05:21
Reportermichael_jediAssigned ToAHUser 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version 
Target VersionFixed in Version3.36 
Summary0004505: JvValidateEdit allows entering DecimalSeparator more than once (with patch)
DescriptionSteps to reproduce:
  - add new TJvaValidateEdit component onto a form
  - set format to dfFloat (or dfFloatGeneral, dfDecimal, dfPercent)
  - compile & run
  - now you are able to enter values like: '11,,,,0,00,11' and so on
Additional InformationI have found out that in the source file of the component there is a check against it but it does not work correctly. This is now in the IsValidChar function (from JVCL334CompleteJCL1102-Build3072.zip):

 Result := (Pos(Key, FCheckChars) > 0) or
      ((Key = DecimalSeparator) and (Pos(DecimalSeparator, S) = 0)) or...

But this check should be:
  Result := ((Pos(Key, FCheckChars) > 0) and
      (((Key = DecimalSeparator) and (Pos(DecimalSeparator, S) = 0)) or (Key <> DecimalSeparator))) or...

I am attaching patch against 3.34 for this issues (corrected also for dfCurrency format)
TagsNo tags attached.

Activities

2008-10-07 06:56

 

JvValidateEdit.pas.diff (1,466 bytes)
--- C:/temp/JvValidateEdit.pas	Thu Oct 25 18:28:26 2007
+++ C:/temp/jvcl/run/JvValidateEdit.pas	Tue Oct 07 15:33:38 2008
@@ -926,8 +926,8 @@
         ((Key = '+') and (Posn = 1) and ((Pos('+', S) = 0) or (SelLength > 0))) or
         ((Key = '-') and (Posn = 1) and ((Pos('-', S) = 0) or (SelLength > 0)));
     dfFloat, dfFloatGeneral, dfDecimal, dfPercent:
-      Result := (Pos(Key, FCheckChars) > 0) or
-        ((Key = DecimalSeparator) and (Pos(DecimalSeparator, S) = 0)) or
+      Result := ((Pos(Key, FCheckChars) > 0) and 
+        (((Key = DecimalSeparator) and (Pos(DecimalSeparator, S) = 0)) or (Key <> DecimalSeparator))) or
         ((Key = '+') and (Posn = 1) and ((Pos('+', S) = 0) or (SelLength > 0))) or
         ((Key = '-') and (Posn = 1) and ((Pos('-', S) = 0) or (SelLength > 0)));
     dfCurrency:
@@ -967,8 +967,8 @@
         if (Key = '(') and (Posn = 1) and (NegCurrFormat in [0, 4, 14, 15]) then
           Key := '-';
 
-        Result := (Pos(Key, FCheckChars) > 0) or
-          ((Key = DecimalSeparator) and (Pos(DecimalSeparator, S) = 0)) or
+        Result := ((Pos(Key, FCheckChars) > 0) and 
+          (((Key = DecimalSeparator) and (Pos(DecimalSeparator, S) = 0)) or (Key <> DecimalSeparator))) or
           ((Key = '+') and (Posn = 1) and ((Pos('+', S) = 0) or (SelLength > 0))) or
           ((Key = '-') and (Posn = ExpectedNegPos) and ((Pos(ExpectedNegChar, S) = 0) or (SelLength > 0)));
       end;
JvValidateEdit.pas.diff (1,466 bytes)

obones

2008-10-10 05:12

administrator   ~0014820

Ok, thanks for the patch.
Issue available for anyone to look at.

AHUser

2008-10-26 05:20

developer   ~0014909

Thanks for the patch. Fixed in SVN

Issue History

Date Modified Username Field Change
2008-10-07 06:56 michael_jedi New Issue
2008-10-07 06:56 michael_jedi File Added: JvValidateEdit.pas.diff
2008-10-10 05:12 obones Note Added: 0014820
2008-10-10 05:12 obones Status new => acknowledged
2008-10-26 05:20 AHUser Status acknowledged => resolved
2008-10-26 05:20 AHUser Fixed in Version => Daily / SVN
2008-10-26 05:20 AHUser Resolution open => fixed
2008-10-26 05:20 AHUser Assigned To => AHUser
2008-10-26 05:20 AHUser Note Added: 0014909