Reputation: 77
I have a <form>
in my html page, which submits without problems in IE or Anonymous mode in Chrome. But it doesn't submit in classic mode of Chrome.
The submit button is completely ignored and nothing happens. I tried deleting history, cache etc. and it did not help.
My code:
Login:
<form method="post" name="loginForm" action="stranky/login.php">
<div style="margin-left:20px;">
Name:<br> <input type=text name="name"><br>
Password:<br> <input type=password name="pswd">
</div>
<input type="submit" onClick="this.form.submit()" class="smallButton" value="Log in">
</form>
As you can see, I even tried onClick="this.form.submit()"
which also did not help.
I have tried also without "onclick".
EDIT: On local computer it works with both browsers, but uploaded on the server it works only with IE. Maybe something is wrong with the website hosting?
SOLUTION AVG cleaned my PC and it started working, perhaps it was some kind of virus
Upvotes: 4
Views: 13273
Reputation: 351
Are your catching your form with JS or PHP? Try giving a name to your submit button name="btnSubmit", in PHP you can catch it via $_POST["btnSubmit"]. In JS via $("input[name='btnSubmit']").on("click", myFunction).
Login:
<form method="post" name="loginForm" action="stranky/login.php">
<div style="margin-left:20px;">
Name:<br> <input type=text name="name"><br>
Password:<br> <input type=password name="pswd">
</div>
<input type="submit" name="btnSubmit" class="smallButton" value="Log in">
</form>
Upvotes: 0
Reputation: 31829
Either remove the onlick
handler, or replace the type="submit"
with type="button"
inside the button, the both conditions are ambiguous.
The the default action of a submit button is to submit the form
, as described here.
Also you can try to submit the form by pressing the Enter key and see if the problem still exists.
If so, then you must disable all Chrome plugins and extensions and try again. Most probably something interfere with the page's forms (or perhaps you are infected with Trojan horse - it is normal "weird" behavior when it happens).
Upvotes: 2