ShowControlError - cWebBaseDEO
Shows field errors for non-data-bound fields
Type: Procedure
Parameters
| Parameter | Type | Description |
|---|---|---|
| iErrNum | Integer | Error number to show |
| sErrText | String | Error text to show |
Syntax
Procedure ShowControlError Integer iErrNum String sErrText
Call Example
Send ShowControlError iErrNum sErrText
Description
The framework allows field errors to be shown on non-data-bound fields using the ShowControlError and HideControlError procedures. Note that a WebSet of psValue and a successful OnValidate event clears all the errors. HideAllControlErrors can be used to hide all errors. Combining this with the OnValidate event allows the developer to implement field validations that behave the same as on a data-aware field.
Object oForm is a cWebForm
Set piColumnSpan to 6
Set psLabel to "5 characters:"
Set pbServerOnValidate to True
Function OnValidate Returns Boolean
Boolean bRetVal
String sVal
Forward Get OnValidate to bRetVal
WebGet psValue to sVal
If (Length(sVal) < 5) Begin
Move False to bRetVal
Send ShowControlError 1 "Please enter more than 5 characters!"
End
Function_Return bRetVal
End_Function
End_Object
The code example above shows how a custom validation can be implemented on a form.