Form validation: Rough port of the v3.1 form validation plugin