I have the following code that handles a form submit after validating. It works BUT it requires the button to be clicked twice. On first click nothing happens and second click i