validate form before submit

I think this should do it. Thanks for the pointer.