<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: jQuery Validation with ASP.NET</title>
	<atom:link href="http://www.zachhunter.com/2010/06/jquery-validation-with-asp-net/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.zachhunter.com/2010/06/jquery-validation-with-asp-net/</link>
	<description>Random Brain Drool</description>
	<lastBuildDate>Thu, 02 Feb 2012 20:52:19 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: krishnam</title>
		<link>http://www.zachhunter.com/2010/06/jquery-validation-with-asp-net/comment-page-1/#comment-808</link>
		<dc:creator>krishnam</dc:creator>
		<pubDate>Sat, 10 Dec 2011 15:55:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.zachhunter.com/?p=314#comment-808</guid>
		<description>sorry i forgot to attach my code.








    Untitled Page
    



$(document).ready(function(){
$(&quot;#result&quot;).click(function(){
$.ajax({
type: &quot;POST&quot;,
url: &quot;AjaxPage.aspx/getDate&quot;,
data: &quot;{}&quot;,
contentType: &quot;application/json; charset=utf-8&quot;,
dataType: &quot;json&quot;,
sucess: function(msg){
$(&quot;#result&quot;).html(msg.d);
}
});
});
});

    
     Click here for time
    



----------

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Web.Services;

public partial class AjaxPage : System.Web.UI.Page
{
    [WebMethod]
    public static string getDate()
    {
        return &quot;hello&quot;;
    }
}

can u plz help me??</description>
		<content:encoded><![CDATA[<p>sorry i forgot to attach my code.</p>
<p>    Untitled Page</p>
<p>$(document).ready(function(){<br />
$(&#8220;#result&#8221;).click(function(){<br />
$.ajax({<br />
type: &#8220;POST&#8221;,<br />
url: &#8220;AjaxPage.aspx/getDate&#8221;,<br />
data: &#8220;{}&#8221;,<br />
contentType: &#8220;application/json; charset=utf-8&#8243;,<br />
dataType: &#8220;json&#8221;,<br />
sucess: function(msg){<br />
$(&#8220;#result&#8221;).html(msg.d);<br />
}<br />
});<br />
});<br />
});</p>
<p>     Click here for time</p>
<p>&#8212;&#8212;&#8212;-</p>
<p>using System;<br />
using System.Collections;<br />
using System.Configuration;<br />
using System.Data;<br />
using System.Linq;<br />
using System.Web;<br />
using System.Web.Security;<br />
using System.Web.UI;<br />
using System.Web.UI.HtmlControls;<br />
using System.Web.UI.WebControls;<br />
using System.Web.UI.WebControls.WebParts;<br />
using System.Xml.Linq;<br />
using System.Web.Services;</p>
<p>public partial class AjaxPage : System.Web.UI.Page<br />
{<br />
    [WebMethod]<br />
    public static string getDate()<br />
    {<br />
        return &#8220;hello&#8221;;<br />
    }<br />
}</p>
<p>can u plz help me??</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: krishnam</title>
		<link>http://www.zachhunter.com/2010/06/jquery-validation-with-asp-net/comment-page-1/#comment-807</link>
		<dc:creator>krishnam</dc:creator>
		<pubDate>Sat, 10 Dec 2011 15:53:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.zachhunter.com/?p=314#comment-807</guid>
		<description>Hi,
    when am trying to use jquery ajax. am getting the value from the called function but it is not showing on success of the $.ajax method..</description>
		<content:encoded><![CDATA[<p>Hi,<br />
    when am trying to use jquery ajax. am getting the value from the called function but it is not showing on success of the $.ajax method..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Zach</title>
		<link>http://www.zachhunter.com/2010/06/jquery-validation-with-asp-net/comment-page-1/#comment-705</link>
		<dc:creator>Zach</dc:creator>
		<pubDate>Tue, 02 Aug 2011 17:50:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.zachhunter.com/?p=314#comment-705</guid>
		<description>Without trying to run the code, it sounds like something isn&#039;t configured right.  I understand your controls have weird names/id, but don&#039;t forget you can also assign validation using css class names (just another option).  The only time I&#039;ve seen a button not trigger the validation event is when the button has been assigned the class name of &quot;cancel&quot; or the button was placed outside the form. Trapping the validation on button click is NOT the way it should be done, since this is already built into the validation plugin and the only reason it&#039;s not firing is due to a coding error somewhere in your code.  Start by building a simple prototype of your page in HTML that works, then add in a bit of your code at a time to track down your error.  Additionally, you might want to look at Firebug to help you track down JS errors (which could be related to the validation issue).</description>
		<content:encoded><![CDATA[<p>Without trying to run the code, it sounds like something isn&#8217;t configured right.  I understand your controls have weird names/id, but don&#8217;t forget you can also assign validation using css class names (just another option).  The only time I&#8217;ve seen a button not trigger the validation event is when the button has been assigned the class name of &#8220;cancel&#8221; or the button was placed outside the form. Trapping the validation on button click is NOT the way it should be done, since this is already built into the validation plugin and the only reason it&#8217;s not firing is due to a coding error somewhere in your code.  Start by building a simple prototype of your page in HTML that works, then add in a bit of your code at a time to track down your error.  Additionally, you might want to look at Firebug to help you track down JS errors (which could be related to the validation issue).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Manoj C.S.</title>
		<link>http://www.zachhunter.com/2010/06/jquery-validation-with-asp-net/comment-page-1/#comment-692</link>
		<dc:creator>Manoj C.S.</dc:creator>
		<pubDate>Fri, 29 Jul 2011 15:07:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.zachhunter.com/?p=314#comment-692</guid>
		<description>jquery validation not working on button-click


Hi all,

We are developing a asp.net application which collects the user information. We are using the jQuery validation as shown below

$(document).ready(function(){
$(&quot;#formx&quot;).validate();

$(&#039;input#phasedControl_txtDOB&#039;).rules(&#039;add&#039;,{
required:true,
DateFormat:true,
ValidDate:true,
Age:true
});
});






Date of Birth:




 





The reason we are not using the inbuilt validation which works on the input name and instead adding rules to each control is because we have aqualogic portal which inserts its own tags for the name and if we try to access them using it would return us the name which contains &quot;:&quot; in the name, like &quot;phasedControl:txtDOB&quot; and jQuery would throw syntax error coz the rules section would look like below

$(document).ready(function(){
    $(&quot;#formx&quot;).validate({
        rules: {
            phasedControl:txtDOB: &quot;required&quot;
              }
});

So we are adding the rules for each and every input control explicitly as shown below

$(&#039;input#phasedControl_txtDOB&#039;).rules(&#039;add&#039;,{
required:true,
DateFormat:true,
ValidDate:true,
Age:true
});

When i go to each textbox and enter the value and clear out the value and move to next text box the required field validator shows the message that &quot;This field is required&quot;. The issue is that when i submit the application by clicking the button, the validations doesn&#039;t work and the next page will be shown. How to resolve this issue and stop the page from submitting if any validation errors are present?

I also tried using below piece of code but with no much help.

$(&quot;input#phasedControl_btnNext&quot;).click(function(evt) {
    // Validate the form and retain the result.
    var isValid = $(&quot;#form_824&quot;).valid();
    // If the form didn&#039;t validate, prevent the
    //  form submission.
    if (!isValid){
      evt.preventDefault();
      }
  });



I would be really thankful if anyone helps me out in resolving the above issue i.e. prevent the page from being submitted if there are any validation errors on that page.

Thanks in advance.

Manoj C.S.</description>
		<content:encoded><![CDATA[<p>jquery validation not working on button-click</p>
<p>Hi all,</p>
<p>We are developing a asp.net application which collects the user information. We are using the jQuery validation as shown below</p>
<p>$(document).ready(function(){<br />
$(&#8220;#formx&#8221;).validate();</p>
<p>$(&#8216;input#phasedControl_txtDOB&#8217;).rules(&#8216;add&#8217;,{<br />
required:true,<br />
DateFormat:true,<br />
ValidDate:true,<br />
Age:true<br />
});<br />
});</p>
<p>Date of Birth:</p>
<p>The reason we are not using the inbuilt validation which works on the input name and instead adding rules to each control is because we have aqualogic portal which inserts its own tags for the name and if we try to access them using it would return us the name which contains &#8220;:&#8221; in the name, like &#8220;phasedControl:txtDOB&#8221; and jQuery would throw syntax error coz the rules section would look like below</p>
<p>$(document).ready(function(){<br />
    $(&#8220;#formx&#8221;).validate({<br />
        rules: {<br />
            phasedControl:txtDOB: &#8220;required&#8221;<br />
              }<br />
});</p>
<p>So we are adding the rules for each and every input control explicitly as shown below</p>
<p>$(&#8216;input#phasedControl_txtDOB&#8217;).rules(&#8216;add&#8217;,{<br />
required:true,<br />
DateFormat:true,<br />
ValidDate:true,<br />
Age:true<br />
});</p>
<p>When i go to each textbox and enter the value and clear out the value and move to next text box the required field validator shows the message that &#8220;This field is required&#8221;. The issue is that when i submit the application by clicking the button, the validations doesn&#8217;t work and the next page will be shown. How to resolve this issue and stop the page from submitting if any validation errors are present?</p>
<p>I also tried using below piece of code but with no much help.</p>
<p>$(&#8220;input#phasedControl_btnNext&#8221;).click(function(evt) {<br />
    // Validate the form and retain the result.<br />
    var isValid = $(&#8220;#form_824&#8243;).valid();<br />
    // If the form didn&#8217;t validate, prevent the<br />
    //  form submission.<br />
    if (!isValid){<br />
      evt.preventDefault();<br />
      }<br />
  });</p>
<p>I would be really thankful if anyone helps me out in resolving the above issue i.e. prevent the page from being submitted if there are any validation errors on that page.</p>
<p>Thanks in advance.</p>
<p>Manoj C.S.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Zach</title>
		<link>http://www.zachhunter.com/2010/06/jquery-validation-with-asp-net/comment-page-1/#comment-689</link>
		<dc:creator>Zach</dc:creator>
		<pubDate>Thu, 28 Jul 2011 16:13:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.zachhunter.com/?p=314#comment-689</guid>
		<description>Tomas,

Right, jQuery will only do client side (real-time) validation.  Once the data hit&#039;s the server, you have to determine the level of validation you need based upon your specific use case (e.g. Survey Form, Order Form, Comments, etc...).  In general, I always use objects to manage my data (so I can write tests), which are strongly typed and perform the basic type checking validation (e.g. You can&#039;t assign a string to an int.).  If there is any special validation needed, I either write a custom validation function or use &lt;a href=&quot;http://fluentvalidation.codeplex.com/&quot; rel=&quot;nofollow&quot;&gt;Fluent Validation for .NET&lt;/a&gt;.  Over the past few months, I&#039;ve relied more on Fluent Validation since it&#039;s very easy to setup/configure/maintain.  There are a few other validation librarys for .NET, but Fluent is a very easy to start with.

I also strongly suggest you install all your &quot;3rd Party Packages&quot; using &lt;a href=&quot;http://nuget.codeplex.com/&quot; rel=&quot;nofollow&quot;&gt;NUGET&lt;/a&gt;.  This is build into VS, will do all the basic setup and DLL inclusion in your project with the click of one button, and keep you up-to-date on updates to the DLL (e.g. Will tell you when v.4 is out.).  You can find &quot;FluentValidaiton&quot; v.3.0.0.1 in NUGET right now.</description>
		<content:encoded><![CDATA[<p>Tomas,</p>
<p>Right, jQuery will only do client side (real-time) validation.  Once the data hit&#8217;s the server, you have to determine the level of validation you need based upon your specific use case (e.g. Survey Form, Order Form, Comments, etc&#8230;).  In general, I always use objects to manage my data (so I can write tests), which are strongly typed and perform the basic type checking validation (e.g. You can&#8217;t assign a string to an int.).  If there is any special validation needed, I either write a custom validation function or use <a href="http://fluentvalidation.codeplex.com/" rel="nofollow">Fluent Validation for .NET</a>.  Over the past few months, I&#8217;ve relied more on Fluent Validation since it&#8217;s very easy to setup/configure/maintain.  There are a few other validation librarys for .NET, but Fluent is a very easy to start with.</p>
<p>I also strongly suggest you install all your &#8220;3rd Party Packages&#8221; using <a href="http://nuget.codeplex.com/" rel="nofollow">NUGET</a>.  This is build into VS, will do all the basic setup and DLL inclusion in your project with the click of one button, and keep you up-to-date on updates to the DLL (e.g. Will tell you when v.4 is out.).  You can find &#8220;FluentValidaiton&#8221; v.3.0.0.1 in NUGET right now.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tomas</title>
		<link>http://www.zachhunter.com/2010/06/jquery-validation-with-asp-net/comment-page-1/#comment-688</link>
		<dc:creator>Tomas</dc:creator>
		<pubDate>Thu, 28 Jul 2011 05:38:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.zachhunter.com/?p=314#comment-688</guid>
		<description>ASP.NET build-in Validation controls offers client-side and server-side validation. If you have replaced them with jQuery validation when you have exposed your web application for hackers. 
I do not find easy way to implement server-side and client-side jQuery validation. I have pushed to duplicate code and managed both jQuery validation and ASP.NET Validation controls which do server side validation.
Could you share your idea about server-side validation in your case?</description>
		<content:encoded><![CDATA[<p>ASP.NET build-in Validation controls offers client-side and server-side validation. If you have replaced them with jQuery validation when you have exposed your web application for hackers.<br />
I do not find easy way to implement server-side and client-side jQuery validation. I have pushed to duplicate code and managed both jQuery validation and ASP.NET Validation controls which do server side validation.<br />
Could you share your idea about server-side validation in your case?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Zach</title>
		<link>http://www.zachhunter.com/2010/06/jquery-validation-with-asp-net/comment-page-1/#comment-682</link>
		<dc:creator>Zach</dc:creator>
		<pubDate>Mon, 25 Jul 2011 16:15:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.zachhunter.com/?p=314#comment-682</guid>
		<description>So you have a page with 2 user controls and validation is only running on the first, right?  If you using my code to validate various groups of control then make sure you apply &quot;validationGroup&quot; to the wrapping element (e.g. &lt;code&gt;fieldset class=&quot;validationGroup&quot;&lt;/code&gt;).  This is used by the custom validation function to tell it which group of elements you validate.  Let me know if this works for you, if not I can throw together a simple example and post online for you.</description>
		<content:encoded><![CDATA[<p>So you have a page with 2 user controls and validation is only running on the first, right?  If you using my code to validate various groups of control then make sure you apply &#8220;validationGroup&#8221; to the wrapping element (e.g. <code>fieldset class="validationGroup"</code>).  This is used by the custom validation function to tell it which group of elements you validate.  Let me know if this works for you, if not I can throw together a simple example and post online for you.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ajey Ghaligi</title>
		<link>http://www.zachhunter.com/2010/06/jquery-validation-with-asp-net/comment-page-1/#comment-680</link>
		<dc:creator>Ajey Ghaligi</dc:creator>
		<pubDate>Mon, 25 Jul 2011 07:01:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.zachhunter.com/?p=314#comment-680</guid>
		<description>variable is obtained as txtAccount1.UniqueID</description>
		<content:encoded><![CDATA[<p>variable is obtained as txtAccount1.UniqueID</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ajey Ghaligi</title>
		<link>http://www.zachhunter.com/2010/06/jquery-validation-with-asp-net/comment-page-1/#comment-679</link>
		<dc:creator>Ajey Ghaligi</dc:creator>
		<pubDate>Mon, 25 Jul 2011 07:00:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.zachhunter.com/?p=314#comment-679</guid>
		<description>Sorry I suppose variables were not copied in my earlier comment. Each of the rule is being performed on the fields as  &quot;&quot;

Thanks.</description>
		<content:encoded><![CDATA[<p>Sorry I suppose variables were not copied in my earlier comment. Each of the rule is being performed on the fields as  &#8220;&#8221;</p>
<p>Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ajey Ghaligi</title>
		<link>http://www.zachhunter.com/2010/06/jquery-validation-with-asp-net/comment-page-1/#comment-678</link>
		<dc:creator>Ajey Ghaligi</dc:creator>
		<pubDate>Mon, 25 Jul 2011 06:58:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.zachhunter.com/?p=314#comment-678</guid>
		<description>Hey Zach,

I have 2 user controls which are being loaded dynamically in a page. I am using the validation jquery plugin to validate the fields in the user controls. Problem is when both the user controls are loaded in the page validation is being performed only in the first user control. Couls you please let me know how to call the validation functions of jquery for both the user controls in the page.
Following is my validation function in one of the user control:

        $(document).ready(function () {
    $(&quot;#aspnetForm&quot;).validate({
        rules: {
            : {
                required: true,
                minlength: 4
	        },
            : {
                required: true,
                email: true,
                showValue: true
            },            
            : {
                required: true,
                maxlength: 25
            }          
        },
        messages:{
         : &quot;Account can not be blank.&quot;,

         : {
         required: &quot; Client Name can not be blank&quot;,
         : &quot;Please limit Client Name of 25 characters.&quot;
         }

        }
    });</description>
		<content:encoded><![CDATA[<p>Hey Zach,</p>
<p>I have 2 user controls which are being loaded dynamically in a page. I am using the validation jquery plugin to validate the fields in the user controls. Problem is when both the user controls are loaded in the page validation is being performed only in the first user control. Couls you please let me know how to call the validation functions of jquery for both the user controls in the page.<br />
Following is my validation function in one of the user control:</p>
<p>        $(document).ready(function () {<br />
    $(&#8220;#aspnetForm&#8221;).validate({<br />
        rules: {<br />
            : {<br />
                required: true,<br />
                minlength: 4<br />
	        },<br />
            : {<br />
                required: true,<br />
                email: true,<br />
                showValue: true<br />
            },<br />
            : {<br />
                required: true,<br />
                maxlength: 25<br />
            }<br />
        },<br />
        messages:{<br />
         : &#8220;Account can not be blank.&#8221;,</p>
<p>         : {<br />
         required: &#8221; Client Name can not be blank&#8221;,<br />
         : &#8220;Please limit Client Name of 25 characters.&#8221;<br />
         }</p>
<p>        }<br />
    });</p>
]]></content:encoded>
	</item>
</channel>
</rss>

