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

Message Box Works with Validators

I have a button that will trigger validators. In one special case, I have to
show a message box when the button is clicked.
In the code behind, I added the following:

cmdAccept.Attributes.Add("onclick", "javascript:checkPayment();")

The message box will not show because of the validators. It will only show
if I set CausesValidation=False on the the button. Is it possible to have
validators on the button as well as pop-up a message box on certain
situations?

thanks,

Cesar
Nov 18 '05 #1
1 1189
When you have the button cause validation, how the framework does that is to
call a JavaScript to validate, and then the JavaScript submits the form. So,
it has already injected an onClick event handler, and now you are injecting
a second one, which is summarily ignored because you only get one handler
per event. In order to get both, set up one with validation, and then copy
the event handler method that is injected. Then, take validation off, run
your script, and call the validation function on the appropriate code path.

--
Chris Jackson
Software Engineer
Microsoft MVP - Windows Client
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)
--

"cksj" <ck*******@hotmail.com> wrote in message
news:eb*************@tk2msftngp13.phx.gbl...
I have a button that will trigger validators. In one special case, I have to show a message box when the button is clicked.
In the code behind, I added the following:

cmdAccept.Attributes.Add("onclick", "javascript:checkPayment();")

The message box will not show because of the validators. It will only show
if I set CausesValidation=False on the the button. Is it possible to have
validators on the button as well as pop-up a message box on certain
situations?

thanks,

Cesar

Nov 18 '05 #2

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

Similar topics

2
by: RichieRich | last post by:
Does anyone know if it is possible? If I have two buttons on a page and in my OnServerValidate function can I figure out which button was pressed. I need to know because I have validators on the...
6
by: Mark | last post by:
We have Validators embedded in an asp table server control. The table server control is necessary and cannot be replaced. We want to apply CSS formatting to the validators, but the validators...
5
by: darrel | last post by:
I'm using some validators for a form. If the field is invalid, the page reloads with the error next to the field. This works, and I like it. I'd also like to add a separate message to the top...
0
by: interuser | last post by:
I have an existing large application that uses validators. I have a problem with the client side validators not working on netscape (and any browser other than IE). As you may already know, the...
4
by: Mike Moore | last post by:
For some reason our validation summary message box works with required validators that we have, but for some reason when we created a custom validator that checks for duplciate records the show...
3
by: John Blair | last post by:
Hi, I have validators outside of a datagrid (for adding a new grid row) - however when i click "edit" column and then the "update" column of a grid row that has been edited - my other...
1
by: Gabriel Lozano-Morán | last post by:
When using the tabstrip control combined with a multipage (several pageview) there is a problem when using validators. The problem is that validation also occurs on the validators that are not on...
0
by: tshad | last post by:
I have the following textbox and 3 validators. For some reason the message "A Password is required!" is displayed with a couple of spaces in front of it. My other validators don't seem to do...
5
by: Suhas Vengilat | last post by:
Hi All, In one of the project discussions, one team member raised a question whether the usage of asp.net validation controls (like RequiredFieldValidator, CustomValidator, RegularExpression...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
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...

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.