views:

318

answers:

1

Hello,

I have a form on a page that has a submit button. If I hit the submit button it posts a jquery POST to another page and logs a user in. Works fine if I use the submit button on the page. If I click 'Go' on the numeric keypad it just refreshes the page.

I assume this is because he form is like this (using iWebkit)...

<span class="graytitle">Login</span>
<ul class="pageitem">
<form name="form" method="post" action="#">
<li class="form"><input placeholder="Username" type="text" id="login"/></li>
<li class="form"><input placeholder="Password" type="password" id="password"/></li></form>
<li class="form"><input type="submit"  onClick="SubmitForm('login')" ></submit></li>
</ul>

You will see the submit is outside the form this is because on any browser the page just reloads. If I use a button rather than a submit I get the same response.

Works fine on desktop safari

Anyone know why this is?

I have tried onSubmit

+1  A: 

I'm pretty sure the submit button needs to be inside the form - why do you need it outside?

Otherwise when the user hits Go, they are submitting the form rather than firing your JS onClick event (similar to if they press Return/Enter after they've finished typing in a text field).

Your Javascript is never called, and nothing happens except the form is submitted to the location you have defined in the "action" field... in this case, "#".

Ben