Client Side onkeyup with enter key

Results 1 to 3 of 3

Thread: Client Side onkeyup with enter key

  1. #1

    Default Client Side onkeyup with enter key

    Normaly I&#039;d just look, but time pressure means I&#039;m asking, cause if there is no easy answer, there will not be a feature.<BR><BR>(for IE only)<BR>I put an asp:textbox with an onkeyup to call a function, but if the key is the enter key, the form gets submitted with the default (aka first) submit button, the alerts don&#039;t happen.<BR>My product finder is not always displayed, when it is not visible, the default button&#039;s submit is the desired behavior.<BR><BR>function ProductFindTextBox_OnKeyUp(SearchButtonID)<BR>{<BR ><BR> alert(window.event.keyCode);<BR> alert(SearchButtonID);<BR> event.cancelBubble=true;<BR> if(window.event.keyCode==13)document.all[SearchButtonID].click();<BR> return false;<BR>}

  2. #2
    Join Date
    Dec 1969

    Default RE: Client Side onkeyup with enter key

    Yeah, IE "helps" you a lot, doesn&#039;t it? Maybe you could switch all your submit buttons to regular buttons, and call form.submit() manually when you actually want to submit?<BR><BR>Mike

  3. #3

    Default RE: Client Side onkeyup with enter key

    I could, but it is more important that other things work as expected than to have the serach box submit on enter.<BR><BR>It&#039;s the form&#039;s onsubmit="ValidatorOnSubmit();", but I don&#039;t want to play with it.<BR><BR>I know a number of ways to work around the problem, but I don&#039;t have time at present.<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts