Aug 27, 2010

HTML Form Hack for disable default button click

I had this requirement that IE by default selected a default button when it is not set by me and when I pressed enter in any of textboxes, the button's click event was triggered. To avoid that and as it is the default IE behaviour and if you don't use panels to set default buttons, here's a nice little html hack that you can do available on this page

http://tapestryjava.blogspot.com/2005/06/html-form-trick.html



What is to be done is basically just keeping a default button which does nothing before any other button. So that if by chance any user happens to press enter on your form text fields, this button will be clicked and no logic will be triggered

No comments:

Post a Comment