468,139 Members | 1,446 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,139 developers. It's quick & easy.

Disable Validation when submitting via JScript?

For reasons that are unlikely to become clear at the moment, I have a page
with some validation controls on it which opens a dialog. The dialog does
*stuff* and then closes with a call to :

parent.document.forms[0].submit();

Unfortunately, this fires off all the validation controls on the page, and
I'd rather it didn't.

Any ideas how I can submit the form programmatically without firing the
validation events?

thanks in advance,
--
jo inferis
Nov 19 '05 #1
7 1743
There is an onsubmit event handler that gets created. To disable it, try:

parent.document.forms[0].onsubmit = null

That should in theory get rid of that event handler.

"Jo Inferis" <jo@inferis.NOSPAM.gotadsl.co.uk> wrote in message
news:eu**************@TK2MSFTNGP09.phx.gbl...
For reasons that are unlikely to become clear at the moment, I have a page
with some validation controls on it which opens a dialog. The dialog does
*stuff* and then closes with a call to :

parent.document.forms[0].submit();

Unfortunately, this fires off all the validation controls on the page, and
I'd rather it didn't.

Any ideas how I can submit the form programmatically without firing the
validation events?

thanks in advance,
--
jo inferis

Nov 19 '05 #2
Marina wrote:
parent.document.forms[0].onsubmit = null

That should in theory get rid of that event handler.


Hmm. Makes sense, but it doesn't work :(

My client side validation isn't running anyway, so that's not an issue. I
want to stop the server side validation from running as well...

--
jo inferis
Nov 19 '05 #3
This suggestion was to deal with client side validation. I don't think you
are going to stop server side validation from running unless you turn it off
on the server.

"Jo Inferis" <jo@inferis.NOSPAM.gotadsl.co.uk> wrote in message
news:ec**************@TK2MSFTNGP09.phx.gbl...
Marina wrote:
parent.document.forms[0].onsubmit = null

That should in theory get rid of that event handler.


Hmm. Makes sense, but it doesn't work :(

My client side validation isn't running anyway, so that's not an issue. I
want to stop the server side validation from running as well...

--
jo inferis

Nov 19 '05 #4
On Wed, 25 May 2005 11:58:48 -0500, Jo Inferis
<jo@inferis.NOSPAM.gotadsl.co.uk> wrote:
For reasons that are unlikely to become clear at the moment, I have a
page
with some validation controls on it which opens a dialog. The dialog does
*stuff* and then closes with a call to :

parent.document.forms[0].submit();

Unfortunately, this fires off all the validation controls on the page,
and
I'd rather it didn't.

Any ideas how I can submit the form programmatically without firing the
validation events?

thanks in advance,
--
jo inferis


You can disable validators on the client-side via JS. If you look in the
web UI validation JS file, which is located somewhere like:

C:\Inetpub\wwwroot\aspnet_client\system_web\1_1_43 22

if you're using 1.1, there's a function in there called ValidatorEnable
that you can call to disable validators. I don't remember if there's a
'disable all' call you can make, or if you have to do one by one. Check
it out if interested....

Note doing it this way will not affect the Page.IsValid check from running
all active validators on the server side as well. Because the Enabled
property for each is in the viewstate and JS doesn't touch or affect that.

--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET
Nov 19 '05 #5
Marina wrote:
This suggestion was to deal with client side validation. Yes, I figured that.
I don't
think you are going to stop server side validation from running
unless you turn it off on the server.

Why not?

Perhaps a hack would be to set up a button which has CausesValidation =
false and then programmatically click it. But I'm not sure this is actually
possible.

--
jo inferis
Nov 19 '05 #6
calling form.submit() does not fire the onsubmit event (which handles
validation). most likely, its the server side validation routines being
called.

"Marina" <so*****@nospam.com> wrote in message
news:uY*************@TK2MSFTNGP12.phx.gbl...
There is an onsubmit event handler that gets created. To disable it, try:

parent.document.forms[0].onsubmit = null

That should in theory get rid of that event handler.

"Jo Inferis" <jo@inferis.NOSPAM.gotadsl.co.uk> wrote in message
news:eu**************@TK2MSFTNGP09.phx.gbl...
For reasons that are unlikely to become clear at the moment, I have a
page
with some validation controls on it which opens a dialog. The dialog does
*stuff* and then closes with a call to :

parent.document.forms[0].submit();

Unfortunately, this fires off all the validation controls on the page,
and
I'd rather it didn't.

Any ideas how I can submit the form programmatically without firing the
validation events?

thanks in advance,
--
jo inferis


Nov 19 '05 #7
Actually it should be. You should be able to call the button 'click' method
on the client.

"Jo Inferis" <jo@inferis.NOSPAM.gotadsl.co.uk> wrote in message
news:uB**************@TK2MSFTNGP15.phx.gbl...
Marina wrote:
This suggestion was to deal with client side validation.

Yes, I figured that.
I don't
think you are going to stop server side validation from running
unless you turn it off on the server.

Why not?

Perhaps a hack would be to set up a button which has CausesValidation =
false and then programmatically click it. But I'm not sure this is
actually
possible.

--
jo inferis

Nov 19 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

11 posts views Thread by peebrain | last post: by
2 posts views Thread by Andrew | last post: by
4 posts views Thread by Tim Meagher | last post: by
7 posts views Thread by nicholas | last post: by
11 posts views Thread by Rik | last post: by
3 posts views Thread by George Thompson | last post: by
27 posts views Thread by didacticone | last post: by
1 post views Thread by gcdp | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.