I put onSubmit= "return myfunction();" in my <form clause on my aspx page.
If the user hits a button the javascript executes just fine. But if the
user changes the selection on a dropdown (that has AutoPostback=true) the
javascript does not get executed.
I want the javascript to execute whenever any control is hit that causes a
postback.
Anyone know why this is not working as I expect it to or what can be done to
get my desired results?
thanks,
TAsp controls who autopostback use the code __doPostBack. I am not sure if
this code calls 'submit'.
--
Direct Email: Michael.Baltic@.RemoveCharactersUpTo#NCMC.Com
Staff Consultant II
Enterprise Web Services
Cardinal Solutions Group
"Tina" wrote:
> I have some javascript that I want executed whenever my form is subitted so
> I put onSubmit= "return myfunction();" in my <form clause on my aspx page.
> If the user hits a button the javascript executes just fine. But if the
> user changes the selection on a dropdown (that has AutoPostback=true) the
> javascript does not get executed.
> I want the javascript to execute whenever any control is hit that causes a
> postback.
> Anyone know why this is not working as I expect it to or what can be done to
> get my desired results?
> thanks,
> T
>
The following is from msdn.
"You can override this event by returning false in the event handler. Use
this capability to validate data on the client side to prevent invalid data
from being submitted to the server. If the event handler is called by the
onsubmit attribute of the form object, the code must explicitly request the
return value using the return function, and the event handler must provide
an explicit return value for each possible code path in the event handler
function.
The submit method does not invoke the onsubmit event handler."
The last sentence says it all.
"Michael Baltic" <MichaelBaltic@.discussions.microsoft.com> wrote in message
news:BAB32C98-CB8A-45CE-8606-831D4B8B24D5@.microsoft.com...
> Asp controls who autopostback use the code __doPostBack. I am not sure if
> this code calls 'submit'.
> --
> Direct Email: Michael.Baltic@.RemoveCharactersUpTo#NCMC.Com
> Staff Consultant II
> Enterprise Web Services
> Cardinal Solutions Group
>
> "Tina" wrote:
> > I have some javascript that I want executed whenever my form is subitted
so
> > I put onSubmit= "return myfunction();" in my <form clause on my aspx
page.
> > If the user hits a button the javascript executes just fine. But if the
> > user changes the selection on a dropdown (that has AutoPostback=true)
the
> > javascript does not get executed.
> > I want the javascript to execute whenever any control is hit that causes
a
> > postback.
> > Anyone know why this is not working as I expect it to or what can be
done to
> > get my desired results?
> > thanks,
> > T
On Fri, 08 Jul 2005 10:44:02 -0700, Michael Baltic wrote:
> Asp controls who autopostback use the code __doPostBack. I am not sure if
> this code calls 'submit'.
Is your button a submit button?. If it is just a button no onSubmit is
triggered (you have to do your own)
Tina,
You have come accross a big fat hole in asp.net. Asp.net produces a
_doPostBack() javascript function using it's
page.RegisterOnSubmitStatement() but the problem is that code generated by
page.RegisterOnSubmitStatement() does not get executed when a page is
submitted using AutoPostBack. GOTCHA!!
There is an article at www.asptoday.com entitled DoPostBack Hijacking that
details how to get around this problem. you will need to subscribe to the
site to get the article but, in my opinion, it is well worth the money
because a 3 month subscription cost less than an hours work.
Regards,
G Dean Blake
www.deanblakely.com
"Tina" <tinamseaburn@.nospammeexcite.com> wrote in message
news:OottPD%23gFHA.1444@.TK2MSFTNGP10.phx.gbl...
>I have some javascript that I want executed whenever my form is subitted so
>I put onSubmit= "return myfunction();" in my <form clause on my aspx page.
> If the user hits a button the javascript executes just fine. But if the
> user changes the selection on a dropdown (that has AutoPostback=true) the
> javascript does not get executed.
> I want the javascript to execute whenever any control is hit that causes a
> postback.
> Anyone know why this is not working as I expect it to or what can be done
> to get my desired results?
> thanks,
> T
0 comments:
Post a Comment