Sadly, I don't think you can.
You could set and error/warning in the button clicked event but that means the screen won't flow as designed and do the rest of it's processing.
Here is the flow when click OK
OK
OK is a standard item that is automatically placed on Headerless Detail forms. It
validates the information on the form and updates or adds to the database through
JDEKRNL function calls.
1. If there are any errors/warnings on the form, stop OK processing
2. Perform Event Rules: Button Clicked
3. For each control on the form
* If the current control is a form control and it has not passed
validation
* Perform Event Rules: Control is Exited
* Perform Event Rules: Control is Exited and Changed Inline
* Perform Event Rules: Control is Exited and Changed Asynch
* Perform Data Dictionary validation
* If the current control is a grid control
* For each grid row
If the current grid row needs to have Leave Row processing run and
is updateable
* Perform Event Rules: Row is Exited and Changed Inline for
current row
* Perform Event Rules: Row is Exited and Changed Asynch for
current row
4. If there are any errors on the form, stop OK processing
5. Delete from the database any grid rows that are in the delete stack. See Delete
for details. For each grid row in the delete stack:
* Copy the grid row data into the Business View structures
* Copy the grid data structures into the business view data structures
* Perform Event Rules: Delete Grid Record from DB Before
* If the database delete has not been suppressed
* Delete the record in the Business View from the database
* Delete the grid row from the grid control
* Perform Event Rules: Delete Grid Record from DB After
6. Perform Event Rules: All Grid Recs Deleted from DB
7. If the form option flag ‘No Update On Grid Business View’ is unchecked
* For each grid row that was changed or added
* Clear the business view data structures
* Reset the original key values for this row in the business view
data structures
* Copy grid data structures to the business view data structures
* Copy all nonfilter database form controls to the business view
data structures
* Copy all equal filters to the business view data structures
* If form is in Add Mode
Perform Event Rules: Add Grid Rec to DB - Before
Add the record in the business view data structure to the database
Perform Event Rules: Add Grid Rec to DB - After
* If form is in Update Mode
Perform Event Rules: Update Grid Rec to DB - Before
Update the record in the business view data structure to the database
Perform Event Rules: Update Grid Rec to DB - After
* If form is in Add Mode
* Perform Event Rules: All Grid Recs Added to DB
* If form is in Update Mode
* Perform Event Rules: All Grid Recs Updated to DB
8. Perform Event Rules: Post Button Clicked
9. If form is in Add Mode
* If form was called in Copy Mode or the flag `End Form On Add' is
checked
* Begin Closing Form
* Else
* Begin Clearing Dialog
10. If the form is in Update Mode
* If there were no errors attempting to update/add to the database
* Begin Closing Form