Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

Key Press problem on Link

 
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

I have a jsp page. Page contains few html controls like text boxes.
It has a link whose href calls "submitRequest()", which should be activated when user clicks on it, or user presses the enter key. So I am catching the Enter key press in function "enter()" and calling function "submitRequest()" from "enter()" for validations. This function( submitRequest()) performs some validations on the text boxes and other controls on the page and show proper alerts if something is not valid.

To implement it I have applied the onkeydown event on the form instead of doing it on individual controls as I also have to catch the key press events for other combinations on the page say Alt+k, anytime on the page. Everything runs ok. But when the focus is on the link and I presses on Enter, first the enter() function gets called, which in turn call submitRequest() and show approprite alert if to be shown. After that the links href calls the same function and shows the same alert for the second time.

How could i prevent this function/alerts for the second time?

Thanks
 
Ranch Hand
Posts: 166
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
are you calling the function twise?
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic