Display validation message before submitting sales order?

  1. I have added new checkbox button(is_production_generate) on sales order page and we need to display validation message(No Items with Bill of Materials to Manufacture).
    We will generate auto production order on sales order submit.


you can add the validate or before_submit hook to add the validation message

Both are working but after submit sales order. We need before submitting sales order.

We do not need to submit sales order if validation is failed. Currently now it is submitting