Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ENTER != submit

Status
Not open for further replies.

Quasibobo

Programmer
Oct 11, 2001
168
NL
Hi,

I'm not sure if I should post this here, or if this is a javascript-thread, but here it goes:

On a web-based scoring-board I've seen that the ENTER-button doesn't submit the textfields, but has the TAB-function (go to next textfield).

How do they do that?
I am about to make a large form with a lot of textfields (quantity of textfield can variate), that can easily be filled in by only using the num-keys on the right side of the keyboard. And nothing should be submitted by hitting ENTER, only by using the SUBMIT-button. ENTER should be: go to next textfield.

Hope anyone can tell me....

Don't eat yellow snow!
 
a_javascript_thread = true;
onEnter("takeSomeAction");

else get_source_code(of_web_based_scoring_board);
 
have a search of the javascript forum (or google) -

you want to catch enter being hit (onKeyDown or something similar is the handler) and change it to something like this.blur()..

good luck

Posting code? Wrap it with code tags: [ignore]
Code:
[/ignore][code]CodeHere
[ignore][/code][/ignore].
 
Quasibobo, this is a JavaScript question.
This is an example on how to de-activate the 'Enter' button from submitting the form.
Code:
<script>
function onKeyPress () {
  var keycode;
  if (window.event) keycode = window.event.keyCode;
  else if (e) keycode = e.which;
  else return true;
  if (keycode == 13) {
    alert(&quot;Please Click on the Submit button to send this&quot;);
    return false
  }
  return true 
}
  document.onkeypress = onKeyPress;
</script>

I have this little thing, Advanced Delusionary Schizophrenia with Involuntary Narcissistic Rage.
It's no big deal really...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top