Form OnValidate event is triggered even when press Delete Button

Hi,
why the OnValidate event is triggered even when i press on Delete button ?
I don’t need to validate fields before deleting a record but only before update/insert .

Is this a bug or something else?

it is not a Bug. SC use this event Onvalidate. in this case you can use a validation like this:

ONVALIDATE EVENT:
if (sc_btn_delete)
{
sc_error_message(“Unable to delete this record”);
}

1 Like

Yes but i would do that onBeforeDelete or hiding /disabling the delete button in onLoad event rather than onValidate .
I think i will do something like this in onValidate event:
if ( sc_btn_insert or sc_btn_update){
validateFields();
}

Hy.
In the majority of the cases when you delete a record you dont need to validate all fields but the primary key.
But there could be cases where you may want to abort the delete process and display a message if some field have specific value .
Therefore I dont consider it a bug but a feature.

2 Likes

Thanks @maxi and @alvagar for answering.
Have a nice day.