<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.asp.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Client Side Web Development</title><link>http://forums.asp.net/130.aspx</link><description>Client-side programming discussions, including CSS, DHTML, JScript/Javascript, etc. &lt;a href="http://aspadvice.com/SignUp/list.aspx?l=18&amp;c=16" target="_blank"&gt;Email List&lt;/a&gt;</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>Re: Javascript disabling other validators present in the page</title><link>http://forums.asp.net/thread/503292.aspx</link><pubDate>Thu, 11 Mar 2004 14:30:09 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:503292</guid><dc:creator>Floatsam</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/503292.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=130&amp;PostID=503292</wfw:commentRss><description>&lt;br /&gt;
 Peter,
&lt;br /&gt;
         Thanks man.I was using it the wrong way.
&lt;br /&gt;
 Thanks again,
&lt;br /&gt;
 Sam.</description></item><item><title>Re: Javascript disabling other validators present in the page</title><link>http://forums.asp.net/thread/502869.aspx</link><pubDate>Thu, 11 Mar 2004 02:51:39 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:502869</guid><dc:creator>PLBlum</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/502869.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=130&amp;PostID=502869</wfw:commentRss><description>So you are saying that the following, which runs the confirm command then validates, doesn't let the other validators to work when the confirm message gets OK clicked?
&lt;br /&gt;

&lt;br /&gt;
btnSave.CausesValidation = false
&lt;br /&gt;
btnSave.Attributes.Add(&amp;quot;onclick&amp;quot;, &amp;quot;if (!ConfirmMessage()) return false; else if (typeof(Page_ClientValidate) == 'function') Page_ClientValidate(); &amp;quot;)
&lt;br /&gt;

&lt;br /&gt;
So long as Page_ClientValidate() is called, all the validators on the page will execute, either showing or hiding their error message.</description></item><item><title>Re: Javascript disabling other validators present in the page</title><link>http://forums.asp.net/thread/502299.aspx</link><pubDate>Wed, 10 Mar 2004 18:33:49 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:502299</guid><dc:creator>Floatsam</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/502299.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=130&amp;PostID=502299</wfw:commentRss><description>&lt;br /&gt;
 Hello Peter,
&lt;br /&gt;
          Got your point.But the problem is the onclick event before adding the attribute using the statement btnSave.Attributes.Add(&amp;quot;OnClick&amp;quot;, &amp;quot;Javascript:return ConfirmMessage();&amp;quot;) looks like
&lt;br /&gt;
 
&lt;br /&gt;
   onclick=&amp;quot;if (typeof(Page_ClientValidate) == 'function') Page_ClientValidate(); &amp;quot;
&lt;br /&gt;

&lt;br /&gt;
and after adding the attribute to the button looks like
&lt;br /&gt;

&lt;br /&gt;
  onclick=&amp;quot;Javascript:return ConfirmMessage();if (typeof(Page_ClientValidate) == 'function') Page_ClientValidate(); &amp;quot;
&lt;br /&gt;

&lt;br /&gt;
   It made no difference even if i added &amp;quot; if (typeof(Page_ClientValidate) == 'function') Page_ClientValidate(); &amp;quot; statement after the return statement in the ConfirmMessage function.
&lt;br /&gt;
So the problem still exists- other validators not working.
&lt;br /&gt;

&lt;br /&gt;
Thanks for the help,
&lt;br /&gt;
Sam.</description></item><item><title>Re: Javascript disabling other validators present in the page</title><link>http://forums.asp.net/thread/502235.aspx</link><pubDate>Wed, 10 Mar 2004 17:46:32 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:502235</guid><dc:creator>PLBlum</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/502235.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=130&amp;PostID=502235</wfw:commentRss><description>Hi Sam, welcome to these forums.
&lt;br /&gt;

&lt;br /&gt;
I recommend sticking with your original design, where you hookup the confirm() command into the onclick event of your button. Simply be sure that your button also generates the necessary client-side javascript that validation would have written. To do this, setup the page without the confirm command code and use View Source to see the HTML generated on the &amp;lt;input type=submit onclick=[code here]/&amp;gt;. Steal that code and use it after your confirm() command returns true.
&lt;br /&gt;

&lt;br /&gt;
If you actually don't want the validators to fire on this command, you can set CausesValidation to false on this button. It no longer adds its own onclick code.
&lt;br /&gt;

&lt;br /&gt;
FYI: My product, &lt;a target="_new" href="http://www.peterblum.com/vam/home.aspx"&gt;Professional Validation And More&lt;/a&gt;, greatly enhances what you can do with validation, including putting up a confirm message when the page is submitted.</description></item><item><title>Javascript disabling other validators present in the page</title><link>http://forums.asp.net/thread/501977.aspx</link><pubDate>Wed, 10 Mar 2004 15:15:36 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:501977</guid><dc:creator>Floatsam</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/501977.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=130&amp;PostID=501977</wfw:commentRss><description>Hello,
&lt;br /&gt;
       i have a dropdown list in a page.If the option delete is selected in the dropdownlist,i have to ask for confirmation.So i wrote a javascript function and added it as an attribute to the buttonsave.Everything is working fine but the validators like requiredfield validator that are present on the page previously are not working.
&lt;br /&gt;
            To get over this problem,i used a customvalidator in place of the javascript function and i associated the following function as the clientvalidationfunction for that customvalidator.
&lt;br /&gt;

&lt;br /&gt;
function ConfirmMessage(sender,args)
&lt;br /&gt;
{
&lt;br /&gt;
if (document.Form1.drpStatus[document.Form1.drpStatus.selectedIndex].value == &amp;quot;Delete&amp;quot;)
&lt;br /&gt;
{ var confirm = window.confirm(&amp;quot;Do you want to delete the item permanently?&amp;quot;);
&lt;br /&gt;
    if (confirm)
&lt;br /&gt;
    {
&lt;br /&gt;
     args.IsValid = true;
&lt;br /&gt;
    }
&lt;br /&gt;
    else
&lt;br /&gt;
   {
&lt;br /&gt;
    args.IsValid = false ;
&lt;br /&gt;
    }    
&lt;br /&gt;
}	
&lt;br /&gt;
}
&lt;br /&gt;

&lt;br /&gt;
Now the problem with this is I have a validation summary control on the page,which is showing up if i click Cancel in the confirmation box since the condition 
&lt;br /&gt;
args.IsValid = false is executed.
&lt;br /&gt;
   Could anyone please suggest work around for this problem, or a solution to keep the validators working even when only the javascript function is used.
&lt;br /&gt;
 
&lt;br /&gt;
Thanks,
&lt;br /&gt;
Sam.</description></item></channel></rss>