Subversion Repositories DevTools

Rev

Rev 5838 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5838 Rev 6543
Line 23... Line 23...
23
   Private InxEndDate
23
   Private InxEndDate
24
   Private InxMinStringLength
24
   Private InxMinStringLength
25
   Private InxMaxStringLength
25
   Private InxMaxStringLength
26
   Private InxRegExp
26
   Private InxRegExp
27
   Private InxRegExpDescription
27
   Private InxRegExpDescription
-
 
28
   Private InxIsName
28
 
29
 
29
   Private mNumOfRules
30
   Private mNumOfRules
30
   Private mLastRuleInx
31
   Private mLastRuleInx
31
 
32
 
32
   Private bIsFormValid
33
   Private bIsFormValid
Line 229... Line 230...
229
            ' --- RULE Regular Expression ---
230
            ' --- RULE Regular Expression ---
230
            If NOT ValidForRegExp ( FieldValue, i ) Then
231
            If NOT ValidForRegExp ( FieldValue, i ) Then
231
               Call AddErrorMessage ( i, maRules( InxRegExpDescription, i ) )
232
               Call AddErrorMessage ( i, maRules( InxRegExpDescription, i ) )
232
            End If
233
            End If
233
 
234
 
234
 
-
 
-
 
235
            ' -- RULE for Name
-
 
236
            Call ValidValidForName ( FieldValue, i)
235
 
237
 
236
         End If
238
         End If
237
 
239
 
238
 
240
 
239
      End If
241
      End If
Line 268... Line 270...
268
         objRegEx.Global = False      ' Only find first match. This is enough to fail the validation
270
         objRegEx.Global = False      ' Only find first match. This is enough to fail the validation
269
         objRegEx.IgnoreCase = False   ' Follow match pattern exactly.
271
         objRegEx.IgnoreCase = False   ' Follow match pattern exactly.
270
          objRegEx.Pattern = maRules( InxRegExp, rowId )       ' Set the pattern to match
272
          objRegEx.Pattern = maRules( InxRegExp, rowId )       ' Set the pattern to match
271
 
273
 
272
         ' Now test the pattern match.
274
         ' Now test the pattern match.
273
         If NOT objRegEx.Test( fieldValue ) Then
275
         If objRegEx.Test( fieldValue ) Then
274
            ValidForRegExp = TRUE
276
            ValidForRegExp = TRUE
275
         End If
277
         End If
-
 
278
         'Err.Raise 8, "Just a Test", "I got here4." & maRules( InxRegExp, rowId ) & ":" & fieldValue & "::" & ValidForRegExp  
276
 
279
 
277
         Set objRegEx = Nothing
280
         Set objRegEx = Nothing
278
      End If
281
      End If
279
   End Function
282
   End Function
280
   '-----------------------------------------------------------------------------------------------------------------
283
   '-----------------------------------------------------------------------------------------------------------------
Line 359... Line 362...
359
         If CInt(Len(fieldValue)) <= CInt(maRules( InxMaxStringLength, rowId )) Then   ValidForMaxStringLength = TRUE
362
         If CInt(Len(fieldValue)) <= CInt(maRules( InxMaxStringLength, rowId )) Then   ValidForMaxStringLength = TRUE
360
 
363
 
361
      End If
364
      End If
362
   End Function
365
   End Function
363
   '-----------------------------------------------------------------------------------------------------------------
366
   '-----------------------------------------------------------------------------------------------------------------
-
 
367
   Private Function ValidValidForName ( fieldValue, rowId )
-
 
368
      ValidValidForName = TRUE
-
 
369
      If maRules( InxIsName, rowId ) = enumDB_YES Then
-
 
370
        Dim myRegExp, FoundMatch
-
 
371
        Set myRegExp = New RegExp
-
 
372
        myRegExp.Pattern = "^\s"
-
 
373
        If myRegExp.Test(fieldValue) Then
-
 
374
            Call AddErrorMessage ( rowId, "Leading Space" )
-
 
375
            ValidValidForName = FALSE
-
 
376
        Else
-
 
377
            myRegExp.Pattern = "\s$"
-
 
378
            If myRegExp.Test(fieldValue) Then
-
 
379
                Call AddErrorMessage ( rowId, "Trailing Space" )
-
 
380
                ValidValidForName = FALSE
-
 
381
            End If
-
 
382
        End If
-
 
383
      End If
-
 
384
   End Function
-
 
385
   '-----------------------------------------------------------------------------------------------------------------
364
   Private Sub AddErrorMessage ( rowId, sErrMsg )
386
   Private Sub AddErrorMessage ( rowId, sErrMsg )
365
      mobjErrorMsg.Item (Cstr( maRules( InxFieldName, rowId ) )) = _
387
      mobjErrorMsg.Item (Cstr( maRules( InxFieldName, rowId ) )) = _
366
         mobjErrorMsg.Item (Cstr( maRules( InxFieldName, rowId ) )) &_
388
         mobjErrorMsg.Item (Cstr( maRules( InxFieldName, rowId ) )) &_
367
         "<tr>"&_
389
         "<tr>"&_
368
         sBULET  &"<td class='val_err'>"&  sErrMsg  &"</td>"&_
390
         sBULET  &"<td class='val_err'>"&  sErrMsg  &"</td>"&_
Line 461... Line 483...
461
      InxEndDate            = 7
483
      InxEndDate            = 7
462
      InxMinStringLength    = 8
484
      InxMinStringLength    = 8
463
      InxMaxStringLength    = 9
485
      InxMaxStringLength    = 9
464
      InxRegExp             = 10
486
      InxRegExp             = 10
465
      InxRegExpDescription  = 11
487
      InxRegExpDescription  = 11
-
 
488
      InxIsName             = 12
466
      mNumOfRules           = 12     ' Number of Rules that can be assigned to one field
489
      mNumOfRules           = 13     ' Number of Rules that can be assigned to one field
467
      mLastRuleInx = mNumOfRules - 1
490
      mLastRuleInx = mNumOfRules - 1
468
 
491
 
469
      ReDim maRules ( mNumOfRules, -1 )
492
      ReDim maRules ( mNumOfRules, -1 )
470
 
493
 
471
      'sSESSION_SEPARATOR = "|SEPARATOR|"      ' Make sure it will never show in regexp field
494
      'sSESSION_SEPARATOR = "|SEPARATOR|"      ' Make sure it will never show in regexp field