Reset/delete error on field

I have a form with a date field.
in the onchange event I check if the entered date is in the week of the week field, if it is not in the week I display an error with sc_error_message.
If I change the week field and click on save I get a message warning me that the date is not in the week (error relating to the date field which seems to remain active).
The record is however regularly saved.
How do I reset or delete the error that remains active on the date field?
Thank you