Hitting enter not submitting my form!

Hi,

when I hit enter on my site after hitting enter it’s not submitting the form. Only clicking on login works. What could be the issue?

this is the site…

http://www.organicsolutionsgroup.com/metronic1.4/login.php

Hi,

I noticed this error on your submit button:


<input type="submit" value="Login" name="login" class="btn green pull-right /> 

You forgot to close the class attribute. Fixing that may help.

Thanks but it didn’t work that way. However I noticed there is a javascript at the end. that’s preventing it. Removing them works but I’m looking for ways to keep them while making it work if that’s possible.

it appears this piece of code is responsible for preventing login with keyboard enter button. But if I’m not mistaking this code suppose to help keyboard enter button?

 $('.login-form input').keypress(function (e) {
	            if (e.which == 13) {
	                if ($('.login-form').validate().form()) {
	                    $('.login-form').submit();
	                }
	                return false;
	            }
	        });

I figured the problem was that I had value=“Login” on my form which was the root of all problems. Although I didn’t get it why that can be a problem…

So this is code you’ve found?

if ($(‘.login-form’).validate().form()) {
$(‘.login-form’).submit();

This only allows form submission if validation returned true. Then return false (should have been preventDefault probably). of course if you don’t even have ths validate() function or whatever is supposed to do validation, it’ll never become true.

This should have been set on the submit event rather than listening only for a keypress. All input methods would normally trigger a submit event and that’s the only thing that makes sense to me in this context.

Though I’ve also seen people try to prevent hitting Enter in the middle of a form from accidentally submitting an incomplete form. IE is (or was, not sure anymore) the only browser that forced users to first focus on the submit button before Enter worked. Lots of people complained over the years that they couldn’t just hit enter on simple forms like logins, but I agree with IE’s behaviour.