Fixing registration form javascript issue