Login
`
Templates, Tools and Utilities
|
||
Add a comment to an Icetips ArticlePlease add your comments to this article.
Please note that you must provide both a name and a valid email address in order
for us to publish your comment. Comments are moderated and are not visible until they have been approved. Spam is never approved!
Back to article list Search Articles Add Comment Printer friendly Direct link Par2: New record validation extension template 2001-02-10 -- Ronald van Raaphorst 1) Entry fields which can not be ze or blank should also be checked.
2) Not the foreground but the background should be coloured when invalid
3) An error icon should be set
Note that in the dictionary the field must be set to:"Can not be zero or
blank"
When populating this field, the field property "required" is set. Turn it of
in the screen, otherwise it won't get coloured, just selected when the OK
button is pressed.
Also set the IMM property to on, so that when a user types the first
character, the colour will be reset.
I just thought it was a little more sophisticated. Have fun.
#EXTENSION(RecordValidation,'Check for empty fields (Compad)'),PROCEDURE
#BOXED('Record Validation')
#DISPLAY('Control Value Validation Conditions..')
#PROMPT('Validate when the control is
Accepted',CHECK),%ValidateOnAccept,AT(10,,150),DEFAULT(1)
#PROMPT('Validate during Non-Stop
Select',CHECK),%ValidateOnNonStopSelect,DEFAULT(1),AT(10,,150)
#PROMPT('Color Fields rather than
Selection',CHECK),%ValidateUsingColoration,DEFAULT(0),AT(10,,150)
#ENABLE(%ValidateUsingColoration)
#PROMPT('Field Color when
Invalid',COLOR),%InvalidFieldColor,DEFAULT(00000FFH)
#PROMPT('Prompt Color when
Invalid',COLOR),%InvalidPromptColor,DEFAULT(00000FFH)
#PROMPT('Show Message when fields are
Invalid',CHECK),%UseValidateMessage,DEFAULT(0),AT(10,,150)
#ENABLE(%UseValidateMessage)
#PROMPT('Message to Display',@s80),%ValidationMessage,DEFAULT('De
gekleurde velden moeten worden ingevoerd.')
#PROMPT('Control to place Message in',FIELD),%MessageControl,REQ
#ENDENABLE
#PROMPT('Show icon when fields are
invalid',CHECK),%UseValidateIcon,DEFAULT(''),AT(10,,150)
#ENABLE(%UseValidateIcon)
#PROMPT('Icon to Display when fields are invalid',OPENDIALOG('Choose
icon','Icons|*.ICO')),%ValidationIcon,DEFAULT('')
#PROMPT('Control to place Icon in',CONTROL),%IconControl,REQ
#PROMPT('Use a Default
Icon',CHECK),%UseDefaultIcon,DEFAULT(''),AT(10,,150)
#ENABLE(%UseDefaultIcon)
#PROMPT('Default Icon',OPENDIALOG('Choose
icon','Icons|*.ICO')),%DefaultIcon,DEFAULT('')
#ENDENABLE
#PROMPT('Use a path where the icons can be
found',CHECK),%UseIconPath,DEFAULT(''),AT(10,,150)
#ENABLE(%UseIconPath)
#PROMPT('Field with the path name (Ending with
''\'')',FIELD),%IconPathVar,DEFAULT('')
#DISPLAY('Hallo Sirp')
#ENDENABLE
#ENDENABLE
#ENDENABLE
#BUTTON('Do Not
Validate...'),MULTI(%ControlsExcluded,%ControlToExclude),AT(10,,180),HLP('~T
PLExtensionRecordValidation')
#PROMPT('Control to Exclude',CONTROL),%ControlToExclude
#ENDBUTTON
#ENDBOXED
#AT(%GatherSymbols)
#FOR(%Control),WHERE(%ControlUse) #! FOR each screen field
#FIND(%Field,%ControlUse) #! FIX to process field
#IF(%Field)
#IF(%FieldLookup) #! IF Must Be In File
#ADD(%ProcFilesUsed,%FieldLookup) #! FIX for file processing
#ENDIF #! END (IF Must Be In File)
#ENDIF
#ENDFOR #! END (FOR each screen
field)
#ENDAT
#AT(%LocalDataAfterClasses),DESCRIPTION('Field Validation, field coloring
support variables')
CurCtrlFeq LONG
FieldColorQueue QUEUE
Feq LONG
OldColor LONG
END
#ENDAT
#AT(%ControlEventHandling),PRIORITY(7500),DESCRIPTION('Perform field level
validation')
#SUSPEND
#IF(%ControlEvent = 'Accepted')
#IF(%ValidateOnAccept OR %ValidateOnNonStopSelect)
#IF(%ValidateOnAccept AND %validateOnNonStopSelect)
#INSERT(%RecordValidationCode)
#ELSIF(%ValidateOnAccept)
#?IF %Window{Prop:AcceptAll} = False
#INSERT(%RecordValidationCode)
#?END
#ELSE
#?IF %Window{Prop:AcceptAll} = True
#INSERT(%RecordValidationCode)
#?END
#ENDIF
#ENDIF
#ENDIF
#RESUME
#ENDAT
#AT(%ControlEventHandling),PRIORITY(7500),DESCRIPTION('Reset coloured
background')
#SUSPEND
! '%ControlEvent'
#IF(%ControlEvent = 'NewSelection')
#INSERT(%ResetFieldColour)
#ENDIF
#RESUME
#ENDAT
#!----------------------------------------------------------------
#GROUP(%RecordValidationCode)
#FIND(%ControlToExclude,%Control)
#IF(NOT %ControlToExclude)
#CASE(%ControlType)
#OF('ENTRY')
#OROF('SPIN')
#OROF('DROP')
#OROF('COMBO')
#FIND(%Field,%ControlUse)
#IF (%Field AND (%FieldLookup OR %FieldRangeLow OR %FieldRangeHigh))
IF Access:%File.TryValidateField(%(%FieldNumber(%Field,%File)))
#ELSIF (%FieldValidation = 'NONZERO') #! Added for
'Cannot be zero or empty
IF (CLIP(%Field) = '' OR (%Field = 0 AND UPPER(SUB('%FieldPicture',1,2)) <>
'@S')) Then
#IF(%ValidateUsingColoration)
FieldColorQueue.Feq = %Control
GET(FieldColorQueue, FieldColorQueue.Feq)
IF ERRORCODE()
FieldColorQueue.OldColor = %Control{Prop:BackGround} #
Today is November 23, 2024, 2:21 am This article has been viewed 35261 times.
|
|