Event fired when a change to the value property of a Field object is attempted; return value determines if the change occurs.

Parameters

<new value>

The proposed new value

Property of

Field

Description

Use canChange to determine whether changes to individual fields occur. canChange fires when something is assigned to the value property of a Field object, either directly or through a dataLinked control. The proposed new value is passed as a parameter to the canChange event handler. If the canChange event handler returns false, the Field objectís value remains unchanged.

While canChange provides field-level validation to see whether changes are saved into the row buffer, use canSave to provide row-level validation to determine whether the buffer can be saved to disk. You should always do row-level validation no matter whether you do field-level validation or not.

The canChange event operates separately from database engine-level validation. Even if canChange returns true, attempting to write an invalid value to a field, for example exceeding a fieldís maximum allowed value, will fail and the fieldís value property will remain unchanged.

You can also use canChange to reverse the field morphing performed by beforeGetValue. Inside the canChange event handler, examine the <new value> parameter and assign the value you want to store in the table directly to the value property of the Field object. Doing so does not fire canChange recursively. Then have the canChange event handler return false so that the <new value> does not get saved into the row buffer.