Home All Groups Group Topic Archive Search About

Quick/Embarrasing Form Submission Question

Author
21 Dec 2005 3:34 AM
Jeff
I have a form that is passed to a subroutine when a button is pressed
via the button's 'onClick' property. That works peachy. However, while
testing I submited the form by hitting enter instead of pressing the
button. In this situation, the subroutine isnt called and nothing is
accomplished.

My question is this: how can I call the subroutine from the form so
that any/all submission events are directed to the subroutine? Before
you mention the 'onSubmit' event, I will also add that I tried that
with no luck.

<form onsubmit="SubmitHandler" runat="server">
   ...lots of controls...
   <asp:Button id="SubmitBtn" onclick="SubmitHandler" runat="server"
Text="Submit" />
</form>

Author
21 Dec 2005 4:22 AM
dbottjer
You can change the button from an ASP:Button to a input type=Submit Then make
your page load call function the ASP:Button would have.

Show quoteHide quote
"Jeff" wrote:

> I have a form that is passed to a subroutine when a button is pressed
> via the button's 'onClick' property. That works peachy. However, while
> testing I submited the form by hitting enter instead of pressing the
> button. In this situation, the subroutine isnt called and nothing is
> accomplished.
>
> My question is this: how can I call the subroutine from the form so
> that any/all submission events are directed to the subroutine? Before
> you mention the 'onSubmit' event, I will also add that I tried that
> with no luck.
>
> <form onsubmit="SubmitHandler" runat="server">
>    ...lots of controls...
>    <asp:Button id="SubmitBtn" onclick="SubmitHandler" runat="server"
> Text="Submit" />
> </form>
>
>