Data.DB.TField.Required
Delphi
property Required: Boolean read FRequired write FRequired default False;
C++
__property bool Required = {read=FRequired, write=FRequired, default=0};
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
property | published | Data.DB.pas Data.DB.hpp |
Data.DB | TField |
Description
Specifies whether a nonblank value for a field is required.
Use Required to find out if a field requires a value or if the field can be blank.
If a field is created with the Fields editor, this property is set based on the underlying table. Applications that set Required to true for fields that must have values (for example, a password or part number), but for which the underlying table does not require the field, must write an OnValidate event handler to enforce the property.
When the Required property reflects a property of the underlying database table, trying to post apply a null value causes an exception to be raised. Applications that set the Required property to true when the underlying table does not require the field, should raise an EDatabaseError exception on null values in the OnValidate event handler in order to achieve the same result.