473,378 Members | 1,542 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

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 1940
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: peebrain | last post by:
I understand how to validate form data when a form is submitted to 'self' (ie. action="$_SERVER_"). In this case you simply validate before processing. However, what if submitting the form to...
2
by: Andrew | last post by:
I've ripped off some script from another site of mine that works fine which checks an input box to see if an email address has been entered when submitting. If it hasn't a prompt is issued asking...
4
by: Tim Meagher | last post by:
I am trying to use both validation controls and to add submit button attributes, but when I add the button attributes, the javascript fpr the validation controls is no longer created for the page. ...
2
by: buran | last post by:
Dear ASP.NET Programmers, I have a web user control (a search menu) which has 2 validation controls (one for input and another for the search criterion). I am including this search user control...
4
by: earwicker | last post by:
I recently deployed a web application which contains a user registration form with the usual fields: name, address, email, password, etc. Each of the TextBoxes uses a validation control to verify...
7
by: nicholas | last post by:
how can I disable a button when the user clicks on it and the webform is validated. I want this to prevent the user from clicking twice and by this submitting the form twice. Thank you. ...
1
by: Simon | last post by:
Hi, Has anyone experienced the problem where validation controls stop a previously working page from submitting. Sometimes, when I move between my work machine and my home machine validation...
11
by: Rik | last post by:
Hello guys, now that I'm that I'm working on my first major 'open' forms (with uncontrolled users I mean, not a secure backend-interface), I'd like to add a lot of possibilities to check wether...
3
by: George Thompson | last post by:
Hi, I come from an ASP background, and I am currently working on a .NET project, so please excuse me if this is a dumb question ... I have written a dynamically generated menu that uses the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.