CommitEdit
Forms, interaction, edit history
Description
Completes the active TPDFlibFormSession edit through one validating and formatting transaction
A text field's candidate value is clamped to its configured /MaxLen at complete grapheme boundaries before validation starts
When the value changed, an available /V validation action is dispatched, and a JavaScript validation runs through ExecuteFormFieldScript with fsaValidateField so its returned value becomes the new candidate
An available /F formatting action is dispatched next, and a JavaScript format script with fsaFormatField produces the display value
The validated raw value is written to the field whilst DisplayValue and the refreshed Widget appearance retain the formatting result, and OnValueChanged fires only after the field and its dirty appearances have been updated
The edit stays fully active when validation, formatting, a host veto or the field write rejects the transaction; an exception raised after the write rolls the stored value back to OriginalValue
Declaration
function CommitEdit: Integer;
Return values
Returns 1 when the transaction succeeded and the edit state was cleared, otherwise 0 when the call was re-entrant, no editable field is active, the field is read-only or a validation, formatting or write step rejected the value
Example
if Session.BeginEdit(FieldIndex) = 1 then
begin
Session.PasteText('42');
if Session.CommitEdit <> 1 then
Session.CancelEdit;
end;
See also
BeginEdit, CancelEdit, Blur, FocusField, ExecuteFormFieldScript, DispatchAction, DisplayValue, ClampTextLength, TPDFlibFormSession