[Mono-list] The prove that they can all live together
Kevin Williams
zak@supernova.org
Mon, 16 Jun 2003 18:06:17 -0500
> All the browsers (except NN4.x and lower) cause the
> event 'onsubmit' to occur on pressing the 'enter' key,
> but unless you actually click the submit button, the
> 'onclick' event never occurs, and which is the way it is
> supposed to function.
All of my ASP.NET pages derive from a common base class. This base
class has a "default button" property. I then have a custom web control
called DefaultButton. When I place a DefaultButton on a page, the
DefaultButton's PreRender event sets the Page's "default button"
property to itself. In the Page base class's Render event, I set an
'onsubmit' javascript for the form to "click()" the "default button".
So long as pressing ENTER somewhere in the form causes the form's
'onsubmit' to fire, I know that my DefaultButton control will be
"click()"ed.
At least, I THINK that's how I'm doing it - I'm not at work now, so I
can't actually look at the code for our site. But I'm pretty sure we've
solved the problem like that or something close to that...
-Zak