Jump to content

Submit button as enter... several submits on page


marmite

Recommended Posts

Hi,

 

Sorry, I know this has been asked many times before, but searching in this forum produces 31 pages...!

 

Can anyone tell me whether I have to use javascript to allow the user to hit enter instead of clicking?

 

Do I need to have the forms in a certain order on the page at all?

 

Very happy to be redirected to another article...

 

Thanks

function checkkey(e){
var keycode;
if (window.event) keycode = window.event.keyCode;
else if (e) keycode = e.which;
if(keycode == 13){
	submitform();
}
}

 

On your form:

 

<body onKeyPress="checkkey(event);">

 

Why don't you use '<form>' tags? The form will be post when user hit enter key.

 

Anyway, hope this help you.

Thanks for this :)

 

I am using a form.... but hitting-enter-to-submit suddenly stopped working when I made some changes to a different page. I have no idea why ???

 

				<form action="login.php" method="POST" id="login" name="login">
				<table width="215px">
					<tr><td><img src="images/spacer.gif" width="1" height="55" alt="" /></td></tr>

					<tr>
						<td width="7px"></td>
                        	<td width="70px">Username:</td>
                        	<td width="140px"><input name="username" type="text" class="footer" id="username" size="15"></td>

                        </tr>
                        <tr>
						<td width="7px"></td>
                        	<td>Password:</td>
                        	<td><input name="password" type="password" class="footer" id="password" size="15">
                        	</td>
                        </tr>

					<tr>
						<td align="center" class="footer" colspan="3"><a href="forgottenpassword.php">Forgotten your password?</a>
						</td>
					</tr>
					<tr>
						<td>
							<img src="images/spacer.gif" width="1" height="3" alt="" />
						</td>
					</tr>
					<tr>
						<td align="center" colspan="3"><input type="image" src="images/loginbutton.gif" id='loginbutton' name='loginbutton' width="80" height="17">
						</td>
					</tr>
				</table>
				</form>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.