Topic: save record action for button

I need to do some data validation on the form before the record is saved - how can I run a scrip onclick of the save button and only save to the database and close the form if all the fields have correct data in them?  I was using an onmouseenter even on the save button - but that seems to fail part of the time and doesn't work if the focus is on the button because of the tab key

Re: save record action for button

Example, event of button with action SAVE RECORD

procedure Form1_Button1_OnClick (Sender: string; var Cancel: boolean);
begin
    if Form1.Edit1.Text='' then
    begin
       ShowMessage('Empty value.');
       Cancel := True; //it cancels the action button
    end;
end;
Dmitry.

Re: save record action for button

Thanks, that is exactly what I needed!