473,471 Members | 1,733 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

validation controls and custom javascript functions

Hi everyone,

Does anyone know if it is possible to append your own
javascript function onto the end of a button's onclick
method when validation controls are used?

Here is an example of the script that is generated when
validation controls are use on the form:

onclick="{if (typeof(Page_ClientValidate) != 'function'
|| Page_ClientValidate()) __doPostBack('btnOk','')}

What I would like to do is append my own custom function
onto the end of this statement. For example:

onclick="{if (typeof(Page_ClientValidate) != 'function'
|| Page_ClientValidate()) __doPostBack
('btnOk','')};showFormSummary();"

Unfortunately I been unable to do so. Regardless of how I
try to append this statement, whether it is in the .aspx
page using the button's client onclick method, or using
the button's "attributes" property collection on the
server side, the validation codes are always appended last
after my own script statements.

If anyone has some suggestion on the matter, I would
greatly appreciate it.

Thanks,

Chris...
Nov 17 '05 #1
2 1716
You can always just set up your own button that calls the validation
controls yourself. Anything that ASP.NET renders, you can just render
yourself and leave it out of the picture. You are already reading the
source - just call the function you want from an <input type=button>, and
then have that function call the client-side validation function.
Alternately, you could do your validation on the server (which you should be
doing anyway, because it's easy for a client to tamper with validation, and
server-side validation does not happen by default).

--
Chris Jackson
Software Engineer
Microsoft MVP - Windows Shell/UI
Windows XP Associate Expert
--
More people read the newsgroups than read my email.
Reply to the newsgroup for a faster response.
(Control-G using Outlook Express)
--

"Chris Barrow" <an*******@discussions.microsoft.com> wrote in message
news:0c****************************@phx.gbl...
Hi everyone,

Does anyone know if it is possible to append your own
javascript function onto the end of a button's onclick
method when validation controls are used?

Here is an example of the script that is generated when
validation controls are use on the form:

onclick="{if (typeof(Page_ClientValidate) != 'function'
|| Page_ClientValidate()) __doPostBack('btnOk','')}

What I would like to do is append my own custom function
onto the end of this statement. For example:

onclick="{if (typeof(Page_ClientValidate) != 'function'
|| Page_ClientValidate()) __doPostBack
('btnOk','')};showFormSummary();"

Unfortunately I been unable to do so. Regardless of how I
try to append this statement, whether it is in the .aspx
page using the button's client onclick method, or using
the button's "attributes" property collection on the
server side, the validation codes are always appended last
after my own script statements.

If anyone has some suggestion on the matter, I would
greatly appreciate it.

Thanks,

Chris...

Nov 17 '05 #2
-----Original Message-----
You can always just set up your own button that calls the validationcontrols yourself. Anything that ASP.NET renders, you can just renderyourself and leave it out of the picture. You are already reading thesource - just call the function you want from an <input type=button>, andthen have that function call the client-side validation function.Alternately, you could do your validation on the server (which you should bedoing anyway, because it's easy for a client to tamper with validation, andserver-side validation does not happen by default).

--
Chris Jackson
Software Engineer
Microsoft MVP - Windows Shell/UI
Windows XP Associate Expert
--
More people read the newsgroups than read my email.
Reply to the newsgroup for a faster response.
(Control-G using Outlook Express)
--

"Chris Barrow" <an*******@discussions.microsoft.com> wrote in messagenews:0c****************************@phx.gbl...
Hi everyone,

Does anyone know if it is possible to append your own
javascript function onto the end of a button's onclick
method when validation controls are used?

Here is an example of the script that is generated when
validation controls are use on the form:

onclick="{if (typeof(Page_ClientValidate) != 'function'
|| Page_ClientValidate()) __doPostBack('btnOk','')}

What I would like to do is append my own custom function
onto the end of this statement. For example:

onclick="{if (typeof(Page_ClientValidate) != 'function'
|| Page_ClientValidate()) __doPostBack
('btnOk','')};showFormSummary();"

Unfortunately I been unable to do so. Regardless of how I try to append this statement, whether it is in the .aspx
page using the button's client onclick method, or using
the button's "attributes" property collection on the
server side, the validation codes are always appended last after my own script statements.

If anyone has some suggestion on the matter, I would
greatly appreciate it.

Thanks,

Chris...

.
Hi Chris,


Thanks for the response. I'll take a look at these
suggestions and go from there.

Thanks,

Chris...
Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Gary Vidal | last post by:
I have a client side Javascript which checks an OrderQuantityField against a hidden Textbox of the Minimum Order Quantity. I dont want to do validation on a postback. I would like to be able to...
2
by: ninja_kornjaca | last post by:
Hello, I'm having a pretty strange problem and I'd appreciate if anyone could help me with it. I'm having a custom error page on my IIS. Specifically, I've written my own ASP (classic ASP)...
5
by: vishesh vyas | last post by:
Hi All, I am having a user control consisting of few mandatory fields. How to validate these mandatory fields on the .aspx page submission? Thanks In Advance Regards, Vishesh
9
by: AFN | last post by:
I was just dropped into someone else's code (isn't that always so fun?). I can't figure out why a custom validation control's server event function is executing. There is nothing (that I see)...
5
by: Sun Jian | last post by:
Hi, I am trying to customize the asp.net validation to achieve the following: Upon submitting the form, client side validation will run, and it will stop at the first error detected. For...
2
by: B. Chernick | last post by:
I have an odd problem with validation and I'm not sure if the problem's in ASP, VB, Javascript, or a third-party component. We created a user control (ASP1.1) that encapsulates a third party...
5
by: Kyle | last post by:
On my Development System, all the page validation controls work fine (WinXP Pro + SP2, VS.NET 2003, .NET v1.1.4322). On the Production System, none of the page validation controls are working...
12
by: Dabbler | last post by:
I need to insure that at least one of three phone number fields has a value (requiredfield) but I'm not sure of a way to implement this without server side logic. Is there a way to use the...
6
by: Mr. SweatyFinger | last post by:
hi. i have a bunch of controls that get validated with the validation controls in vs2005 there are two that i could not find a control for so i wrote some javascript. so i set my submit...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.