Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Message Box Works with Validators

Reply
Thread Tools

Message Box Works with Validators

 
 
cksj
Guest
Posts: n/a
 
      11-28-2003
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


 
Reply With Quote
 
 
 
 
Chris Jackson
Guest
Posts: n/a
 
      11-28-2003
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
div box questions; float text around a box, fit box to image size Gnarlodious HTML 4 05-05-2010 11:30 AM
Validators work on dev box but not in production Mark Abbott ASP .Net 2 04-19-2006 04:33 PM
When I turn on my PC, it works, works, works. Problem! Fogar Computer Information 1 01-17-2006 12:57 AM
Regular Expression validators NOT working, Required Field validators ARE working Ratman ASP .Net 0 09-14-2004 09:36 PM
After rebooting my PC works, works, works! Antivirus problem? Adriano Computer Information 1 12-15-2003 05:30 AM



Advertisments