Jump to content

enter to submit form


contra10

Recommended Posts

im trying to allow the user to hit enter from the keyboard instead of moving the cursor to the button and clicking submit

 

<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<input type="text" name="status" maxlength="30">
<br>
<input type="image" value="Update" name="submit"
src="cooltext415698324.png" 
onmouseover="this.src='coolMouseOver.png';" 
onmouseout="this.src='cool.png';" />

 

thats my submit button

Link to comment
Share on other sites

If the user hits enter in a text field, it usually automatically submits the form in most browsers.

 

 

 

 

 

 

darkfreaks, excuse my bluntness here, but did you write the jQuery Validation Plugin or something?  Seems like 95% of the JS posts you write you push it on the OP.

Link to comment
Share on other sites

The Submit element has no bearing on whether the enter key will work to submit the form. As long as the has focus on some types of fields, the form will be submitted using the enter key.

 

With focus on Text, Radio, and Checkbox fields the enter key will submit the form. A textarea will, of course, not submit the form. Neither does a select list (at least not in IE) not sure why that wouldn't work.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.