I'm trying to do some form validation on my custom meta box, and I remember somewhere reading about some javascript function to disable/enable the Publish button - except I can't find it.

How do I either 

a) enable/disable the publish button or,

b) when Publish is clicked, trap it and prevent the update and alert the user, but in such a way that it can be updated later 

I've tried just a simple click handler with e.preventDefault() and e.stopPropagation however the swily icon comes up and the button stays disabled because it never finishes

Thanks