form onsubmit event not firing

R

Ramdas

I have a form control and onsumit i need to run the client
code, Itis not firing the event
any help would be appreciated

<form id="Form1" method="post" runat="server"
onsubmit="Form1OnSubmit()" >

<script language="javascript">
function Form1OnSubmit()
{
//code here
}
</script>
 
S

Scott G.

To use onsubmit you have to "replace" the __doPostBack; if you look at the page source you'll see that the __doPostBack function does something like:

your-form.submit();

What __doPostBack needs to do is something like ...

if (your-form.onsubmit != null ) your-form.onsubmit();

You can get around this by adding your own client script and wrapping the __doPostBack.

Scott
I have a form control and onsumit i need to run the client
code, Itis not firing the event
any help would be appreciated

<form id="Form1" method="post" runat="server"
onsubmit="Form1OnSubmit()" >

<script language="javascript">
function Form1OnSubmit()
{
//code here
}
</script>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top