| | |
Auto button when user hits the Enter key
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jun 2009
Posts: 38
Reputation:
Solved Threads: 0
Hi
I am developing a login screen for my website, with usercode and password fields, and a Login button.
I need to know how I can make the Login button automatically submit when the user hits the Enter key in either field (as apposed to the user clicking the Login button, which already works).
Thanks
Nigel
I am developing a login screen for my website, with usercode and password fields, and a Login button.
I need to know how I can make the Login button automatically submit when the user hits the Enter key in either field (as apposed to the user clicking the Login button, which already works).
Thanks
Nigel
Can you post the form it is most likley the way you have structured the form.
Posts should be like mini-skirts, long enough to cover enough, but not too long that you cover too much.
My Liveperson: http://liveperson.com/josh-connerty/
My Liveperson: http://liveperson.com/josh-connerty/
Browsers do that by default. They will submit the form you're currently on when you hit enter(unless you're in a textbox) you don't have to do anything special.
GCS d- s+ a-->? C++(++++) UL+++ P+>+++ L+++ E--- W+++
N+ o K w++(---) O? !M- V PS+>++ PE+ Y+ PGP !t- 5? X- R tv+
b+>++ DI+ D G++>+++ e+ h+>++ r y+
PMs asking for help will not be answered, post on the forums. That's what they're there for.
N+ o K w++(---) O? !M- V PS+>++ PE+ Y+ PGP !t- 5? X- R tv+
b+>++ DI+ D G++>+++ e+ h+>++ r y+
PMs asking for help will not be answered, post on the forums. That's what they're there for.
hi
i think you want that login form submit that user press enter key after entering password right.
so i pu one example here where i call javascript function on keypress of textbox
Thanks
i think you want that login form submit that user press enter key after entering password right.
so i pu one example here where i call javascript function on keypress of textbox
PHP Syntax (Toggle Plain Text)
<input name="login2" type="password" class="form" id="login2" maxlength="30" style="width:180" onKeyPress="return entersubmit(this,event)"/>
PHP Syntax (Toggle Plain Text)
<script type="text/javascript"> function entersubmit(field,e) { var keycode; if (window.event) keycode = window.event.keyCode; else if (e) keycode = e.which; else return true; if (keycode == 13) { //alert('hi'); if(Email.validate() && Passwd.validate()) { field.form.action="userlogin"; field.form.submit(); return false; } } else return true; } </script>
Thanks
"Be honest"
"Confidence is everything"
"Confidence is everything"
No you don't...
At least I don't...
Should do it fine, I presume nigelburrell (if he is still alive) has made a little cock up in his form, the idea is that it submits the current form...
At least I don't...
Should do it fine, I presume nigelburrell (if he is still alive) has made a little cock up in his form, the idea is that it submits the current form...
Posts should be like mini-skirts, long enough to cover enough, but not too long that you cover too much.
My Liveperson: http://liveperson.com/josh-connerty/
My Liveperson: http://liveperson.com/josh-connerty/
•
•
Join Date: Jun 2009
Posts: 38
Reputation:
Solved Threads: 0
•
•
•
•
hi
i think you want that login form submit that user press enter key after entering password right.
so i pu one example here where i call javascript function on keypress of textbox
PHP Syntax (Toggle Plain Text)
<input name="login2" type="password" class="form" id="login2" maxlength="30" style="width:180" onKeyPress="return entersubmit(this,event)"/>PHP Syntax (Toggle Plain Text)
<script type="text/javascript"> function entersubmit(field,e) { var keycode; if (window.event) keycode = window.event.keyCode; else if (e) keycode = e.which; else return true; if (keycode == 13) { //alert('hi'); if(Email.validate() && Passwd.validate()) { field.form.action="userlogin"; field.form.submit(); return false; } } else return true; } </script>
Thanks
•
•
Join Date: Jun 2009
Posts: 38
Reputation:
Solved Threads: 0
•
•
•
•
No you don't...
At least I don't...
Should do it fine, I presume nigelburrell (if he is still alive) has made a little cock up in his form, the idea is that it submits the current form...
Thanks for your help.
![]() |
Similar Threads
- Starting wxPython (GUI code) (Python)
- 2d array help please (C)
- logic error that i cannot find... HELP? (C++)
- A small calculator in vb (VB.NET)
- Do While loop not working (VB.NET)
- what's wrong with this code ? (C++)
- How to fire a HTML button by default when enter key is pressed using javascript..? (JavaScript / DHTML / AJAX)
- Capture the Enter Key in an Edit Control (C++)
- Problem with Keyboard Event <Enter> Key (JavaScript / DHTML / AJAX)
- Tkinter: protecting text in the Entry widget (Python)
Other Threads in the PHP Forum
- Previous Thread: Send email from PHP
- Next Thread: WordPress scope???
| Thread Tools | Search this Thread |
apache api array beginner binary broken cache cakephp checkbox class cms code confirm cron curl customizableitems database date display dynamic echo email error external fcc file files folder form forms forum freelancing function functions google header headmethod howtowriteathesis href htaccess html iframe image include insert ip javascript joomla limit link login mail malfunction menu method mlm mod_rewrite multiple mysql neutrality oop pageing pagerank paypal pdf php phpmysql play problem query question radio random recursion remote root script search select server sessions sms soap source space sql support! syntax system table template tutorial update upload url validator variable video web youtube






