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
https://forums.phpfreaks.com/topic/149048-enter-to-submit-form/
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
https://forums.phpfreaks.com/topic/149048-enter-to-submit-form/#findComment-782703
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
https://forums.phpfreaks.com/topic/149048-enter-to-submit-form/#findComment-783148
Share on other sites

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.