A Newbie Question

  • Thread starter Thread starter RC
  • Start date Start date
R

RC

Hi,

I have built a simple form with 2 text boxes and a button

<form runat=server ....
<asp:TextBox id='txt_1"....
<asp:TextBox id='txt_2"....
<asp:Button id='btn_submit'.....
<asp:Button id='btn_reset' ....
</form>


When I focus on 'txt_1' of the form, and press enter. it will then auto
submit the form.
How can I disable auto submit even if press enter on the textbox? I want
user explicitly click on/focus on the submit button before submit the form.

Thanks.

RC
 
Sorry I managed to reply with an empty email.. woops..

Add this Javascript to your page:

function noenter() {
return !(window.event && window.event.keyCode == 13);
}

and in the body tag add this:

onkeypress="javascript:return noenter();"

That will pretty much disable Enter on the page..

best Regards
/Lars Netzel
 
Back
Top