That problem is just a JsFiddle problem. Functions declared in JsFiddle are automatically wrapped in their own scope, so they are not global and therefore not visible to the code declared in your onsubmit
attribute. If you force the function to be global it will work:
window.validateBuyForm = function() {
alert('we are validating!!');
return false;
}