Allow validation

Right now the plugin just submits the API call onClick with no room in between for a clientside validation function.

I've added two function to the options object. One for a validation function to prevent the API callback and another for some reaction. The default validation function includes a simple "not empty" condition but the default onError function is empty as the plugin currently doesn't get involved in the UI at all.