How to bypass onsubmit event when post back DDL event?


Hello, friends, 
In the source code, there was a JavaScript function isValidInput() for form onsubmit event, i.e., onsubmit="return isValidInput()"
In VS2003, this function was not called when SelectedIndexChanged event in DropDownList boxes was fired.
In VS2008, this function was called when SelectedIndexChanged event in DropDownList boxes was fired.
In either case, DropDownList had property AutoPostBack="true". Therefore,
Before, when a user selected a different list index from DDL, it won't check validation. So, it worked. (It validated inputs only when a user clicked on Send button to submit this form).
Now, when a user selected a different list index from DDL, it WILL check validation. User can go nowhere since he/she need more data based on the selected item in DDL. So, now it does work.
If I get rid of isValidInput() function, events are fired as normal.
How to get around this? Any ideas? (This would be a nightmare if we had to rewrite it in VS.net 2008 since it is a pretty big app)
Thanks a lot for your help.
(Modified from Why SelectedIndexChanged event in DropDownList boxes not firing? )
-1
vbird2k
5/5/2009 12:17:31 AM
📁 asp.net.web-forms
📃 93655 articles.
⭐ 6 followers.

💬 2 Replies
👁️‍🗨️ 4327 Views



Do you have, or can you add, a Submit button to the form?  If so, you can move the isValidInput function to the onclientclick event of this button.  That might work for you.

C# <---> VB.Net Translator
-1
MetalAsp
5/5/2009 1:30:58 AM

MetalAsp.Net:

Do you have, or can you add, a Submit button to the form?  If so, you can move the isValidInput function to the onclientclick event of this button.  That might work for you.


Great! Thanks.
Do you know it works for other non-IE browsers?
-1
vbird2k
5/5/2009 1:52:26 AM
Reply: