I've been working on a custom Joomla component for a client at work, and needed to validate that certain aspects of the admin form. I could have recreated the wheel and written my own validation routine, but I really wanted to use Joomla's core validation behavior. What follows is how I managed to validate a form when submitted using the core Joomla toolbar buttons.
The first thing I did was add the form validation behavior into my view, as this is not loaded by default:
JHTML::_( 'behavior.formvalidation' );
I added this one liner to both the displayEdit and displayAdd functions in my form's view. The next step was to add the necessary items to my form. In the view's template, I changed my form tag to have a specific class and submit function:
<form action="index.php" method="post" name="adminForm" id="adminForm" class="form-validate" onsubmit="return doValidate( this );">
Then, on each input/textarea that I wanted to validate, I added the class "required", as well as any specific validation classes available (see here for all the classes available).
One caveat I should mention is that this override does indeed ignore the 'cancel' button, thus allowing the form to be canceled using the toolbar 'Cancel' button, which is something not taken into account in the original snippet I found on the Joomla forums.