473,386 Members | 1,873 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,386 software developers and data experts.

Client Side Validation is Not Happening

I hope this is something I can solve without contacting the vendor:
I'm implementing a 3rd party component that will, by itself, initiate a
PostBack. Apparently it does not support the CausesValidation property - so
forms get posted back without any client-side validation. I know I can do
validation server side (and do anyway just as a good practice), but I want
this control (which is basically an ImageButton) to trigger client-side
validation.

This is how the 3rd party component appears in the rendered HTML (via View
Source from IE):

<a id="_ctl0:_ctl2:MyButton"
href="javascript:__doPostBack('_ctl0$_ctl2$MyButto n,'')"><img
id="_ctl0__ctl2_MyButton" CausesValidation="True"
src="http://images.somesite.org/images/clickhere.gif" alt="" border="0"
/></a>

You can see that I added CausesValidation="True" but still no client side
validation.

FWIW: ASP.NET 1.1 and I'm using just the standard ASP.NET validators
(required field - nothing tricky). Also, on the same form I have a standard
asp:Button that, when clicked, does cause the validation as expected - so I
know that the validator is working as expected.

Thanks!
Nov 19 '05 #1
3 2944
if the control doesnt support it you are most likely out of luck.
You MAY be able to wrap their control into your own (inheriting from theirs)
and adding the necessary functionality, but that would be a lot of work (and
possibly illegal depending on the control).

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

"Guadala Harry" wrote:
I hope this is something I can solve without contacting the vendor:
I'm implementing a 3rd party component that will, by itself, initiate a
PostBack. Apparently it does not support the CausesValidation property - so
forms get posted back without any client-side validation. I know I can do
validation server side (and do anyway just as a good practice), but I want
this control (which is basically an ImageButton) to trigger client-side
validation.

This is how the 3rd party component appears in the rendered HTML (via View
Source from IE):

<a id="_ctl0:_ctl2:MyButton"
href="javascript:__doPostBack('_ctl0$_ctl2$MyButto n,'')"><img
id="_ctl0__ctl2_MyButton" CausesValidation="True"
src="http://images.somesite.org/images/clickhere.gif" alt="" border="0"
/></a>

You can see that I added CausesValidation="True" but still no client side
validation.

FWIW: ASP.NET 1.1 and I'm using just the standard ASP.NET validators
(required field - nothing tricky). Also, on the same form I have a standard
asp:Button that, when clicked, does cause the validation as expected - so I
know that the validator is working as expected.

Thanks!

Nov 19 '05 #2
you have to change the rendered html. the control is supposed to check the
if it causes validation and change its client postback code (by calling
GetClientValidatedPostback). so it should have rendered like:

<a id="_ctl0:_ctl2:MyButton"
href="javascript:{if (typeof(Page_ClientValidate) == 'function')
Page_ClientValidate())__doPostBack('_ctl0$_ctl2$My Button,'')}">
<img id="_ctl0__ctl2_MyButton" CausesValidation="True"
src="http://images.somesite.org/images/clickhere.gif" alt="" border="0"
/>
</a>
-- bruce (sqlwork.com)
"Guadala Harry" <GM**@NoSpam.com> wrote in message
news:e9**************@TK2MSFTNGP10.phx.gbl...
I hope this is something I can solve without contacting the vendor:
I'm implementing a 3rd party component that will, by itself, initiate a
PostBack. Apparently it does not support the CausesValidation property -
so forms get posted back without any client-side validation. I know I can
do validation server side (and do anyway just as a good practice), but I
want this control (which is basically an ImageButton) to trigger
client-side validation.

This is how the 3rd party component appears in the rendered HTML (via View
Source from IE):

<a id="_ctl0:_ctl2:MyButton"
href="javascript:__doPostBack('_ctl0$_ctl2$MyButto n,'')"><img
id="_ctl0__ctl2_MyButton" CausesValidation="True"
src="http://images.somesite.org/images/clickhere.gif" alt="" border="0"
/></a>

You can see that I added CausesValidation="True" but still no client side
validation.

FWIW: ASP.NET 1.1 and I'm using just the standard ASP.NET validators
(required field - nothing tricky). Also, on the same form I have a
standard asp:Button that, when clicked, does cause the validation as
expected - so I know that the validator is working as expected.

Thanks!

Nov 19 '05 #3
Thanks Bruce and Curt;
I don't think the vendor would really care (PayPal provides it for free in
their .NET SDK which is apparently unaware of validation and other
ASP.NET-specific features). I'd like to take a shot at making it happen as
you suggested was possible and I don't mind writing some code. I have never
extended an existing control, much less someone elses. Can you or someone
else here give me some high-level direction to cut down on some of the
research I'm going to do on this?

Apparently PayPal wouldn't care if we extended their stuff - as can be seen
from this thread in their free NG regarding same topic.
http://paypal.forums.liveworld.com/t...t=-1#100015819

Thanks

"Bruce Barker" <br******************@safeco.com> wrote in message
news:eD**************@TK2MSFTNGP12.phx.gbl...
you have to change the rendered html. the control is supposed to check the
if it causes validation and change its client postback code (by calling
GetClientValidatedPostback). so it should have rendered like:

<a id="_ctl0:_ctl2:MyButton"
href="javascript:{if (typeof(Page_ClientValidate) == 'function')
Page_ClientValidate())__doPostBack('_ctl0$_ctl2$My Button,'')}">
<img id="_ctl0__ctl2_MyButton" CausesValidation="True"
src="http://images.somesite.org/images/clickhere.gif" alt=""
border="0" />
</a>
-- bruce (sqlwork.com)
"Guadala Harry" <GM**@NoSpam.com> wrote in message
news:e9**************@TK2MSFTNGP10.phx.gbl...
I hope this is something I can solve without contacting the vendor:
I'm implementing a 3rd party component that will, by itself, initiate a
PostBack. Apparently it does not support the CausesValidation property -
so forms get posted back without any client-side validation. I know I can
do validation server side (and do anyway just as a good practice), but I
want this control (which is basically an ImageButton) to trigger
client-side validation.

This is how the 3rd party component appears in the rendered HTML (via
View Source from IE):

<a id="_ctl0:_ctl2:MyButton"
href="javascript:__doPostBack('_ctl0$_ctl2$MyButto n,'')"><img
id="_ctl0__ctl2_MyButton" CausesValidation="True"
src="http://images.somesite.org/images/clickhere.gif" alt="" border="0"
/></a>

You can see that I added CausesValidation="True" but still no client side
validation.

FWIW: ASP.NET 1.1 and I'm using just the standard ASP.NET validators
(required field - nothing tricky). Also, on the same form I have a
standard asp:Button that, when clicked, does cause the validation as
expected - so I know that the validator is working as expected.

Thanks!


Nov 19 '05 #4

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

Similar topics

4
by: | last post by:
Hello Guys, I am using the validation controls to validate my data. But the problem is "The page is still being posted to server". I want to get rid of the round trips to server. Are there...
14
by: Matt | last post by:
I want to know if ASP.NET Web Forms Validation Controls are Server-Side or Client-Side form validation? Since I think each validator control can select either 1) JavaScript based error dialog or 2)...
4
by: | last post by:
Hi Has anyone any experience using client side validation with asp.net forms. Specifically I'd like to know... 1. How do you attach client side code web controls (a button), like a...
1
by: XtremeGod | last post by:
Hi All, We have an ASP.NET web app that makes use of client side validation. It has a simple form on it with two buttons. One a clear button the other a submit button. When WebUIValidation.js...
1
by: rmgalante | last post by:
I have written an ASP.Net application that uses the standard client-side and server-side validation for various fields on the form. Some of the customers that use the form report symptoms that...
9
by: Alan Silver | last post by:
Hello, I have some simple client-side Javascript validation that was working fine until now. For some reason (don't ask me), it has stopped working and I can't figure out why. I have switched to...
1
by: Velvet | last post by:
Does anyone know a way to force the client script to preform a client-side validation for controls in validation groups? What is currently happening is I have two validation groups (Billing,...
4
by: Lewis Holmes | last post by:
Hi I have the following situation in one of my asp.net pages. The user can add multiple table rows to a form by selecting a button. These rows can contain asp.net controls. When this button is...
2
by: goscottie | last post by:
I need to find a way to either 1. run and check all Validation controls (in my case one CompareValidator) and run client side javascript function. In this case I'll use <asp:Button>. So if all...
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: 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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
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...

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.