Fixing error message and adding javascript for submit