The documentation at http://developers.marketo.com/documentation/websites/forms-2-0/ was updated a while ago with a better example #9 for using the onValidate event to check if fields are valid. The example blocks form submission if the field is invalid and shows a custom error message pointing to the field. If the field becomes valid, it unblocks form submission.
The problem with this example previously was that it used to try to use the onSubmit event instead of onValidate, and an onSubmit function will not get called again if you've call form.submitable(false)
I've also started talking with our documentation people about figuring out how to make the examples interactive, or at least making them each have a running form that shows what output you'd expect.
@Ian - thanks for the update - yes the example was updated the day after my post of 7/11/2014 I believe - (although the comment on line 2 still says: "//listen for the submit event" ?)
Just FYI... I think you also need a tested & working example for onFormRender method - as per this conversation with Murza - the API reference on that page claims that the method is on form - but I've discovered it only exists on MktoForms2, so that needs sorting out before it wastes anymore of anyone elses time.
You'd basically just need to create a new HTML Snippet on your landing page and put a <script> </script> tag into it. Then, inside the body of the script tag, for any of the examples, you'd change the first line so that instead of loading the form, it grabs the form that is already on the page when it's ready:
Yes, it looks like the documentation for the whenReady, onFormRender, and whenRendered functions got put in the wrong section of the documentation when it was copied out of our internal documentation resource onto the developer site. I'll try to get that corrected. They're not meant to be methods on the form object, they're the way that you get a reference to the form object from a global context when you don't have it yet.