RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TField.Required Property

Specifies whether a nonblank value for a field is required.

Pascal
property Required: Boolean;
C++
__property Boolean 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. 

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!