<?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: ASP.NET MVC Tip #3: Client-side form validation made easy &#8211; Part 1</title>
	<atom:link href="http://devermind.com/aspnet-mvc/asp-net-mvc-tip-3-how-to-cover-all-your-client-side-form-validation-needs-without-writing-any-javascript-part1/feed/" rel="self" type="application/rss+xml" />
	<link>http://devermind.com/aspnet-mvc/asp-net-mvc-tip-3-how-to-cover-all-your-client-side-form-validation-needs-without-writing-any-javascript-part1/</link>
	<description>Adrian Grigore's software development weblog. Motto: I will not waste my time looking for a clever motto.</description>
	<lastBuildDate>Wed, 10 Mar 2010 11:17:23 +0100</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: ASP.NET MVC Tip #4: Client-side form validation made easy &#8211; Part 2 &#124; devermind.com</title>
		<link>http://devermind.com/aspnet-mvc/asp-net-mvc-tip-3-how-to-cover-all-your-client-side-form-validation-needs-without-writing-any-javascript-part1/comment-page-1/#comment-391</link>
		<dc:creator>ASP.NET MVC Tip #4: Client-side form validation made easy &#8211; Part 2 &#124; devermind.com</dc:creator>
		<pubDate>Mon, 11 Jan 2010 13:00:55 +0000</pubDate>
		<guid isPermaLink="false">http://devermind.com/?p=152#comment-391</guid>
		<description>[...] my previous article about ASP.NET MVC Client-Side validation, I showed how to set up your project so that you [...]</description>
		<content:encoded><![CDATA[<p>[...] my previous article about ASP.NET MVC Client-Side validation, I showed how to set up your project so that you [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Adrian Grigore</title>
		<link>http://devermind.com/aspnet-mvc/asp-net-mvc-tip-3-how-to-cover-all-your-client-side-form-validation-needs-without-writing-any-javascript-part1/comment-page-1/#comment-381</link>
		<dc:creator>Adrian Grigore</dc:creator>
		<pubDate>Sat, 12 Dec 2009 09:29:32 +0000</pubDate>
		<guid isPermaLink="false">http://devermind.com/?p=152#comment-381</guid>
		<description>@Olivier: Yes, that&#039;s what I mean by entity-based validation. I am going to show this in the next article. I had planned to write this MUCH earlier, but lately I am very busy at work...</description>
		<content:encoded><![CDATA[<p>@Olivier: Yes, that&#8217;s what I mean by entity-based validation. I am going to show this in the next article. I had planned to write this MUCH earlier, but lately I am very busy at work&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Olivier</title>
		<link>http://devermind.com/aspnet-mvc/asp-net-mvc-tip-3-how-to-cover-all-your-client-side-form-validation-needs-without-writing-any-javascript-part1/comment-page-1/#comment-380</link>
		<dc:creator>Olivier</dc:creator>
		<pubDate>Fri, 11 Dec 2009 22:09:59 +0000</pubDate>
		<guid isPermaLink="false">http://devermind.com/?p=152#comment-380</guid>
		<description>Hi Adrian,
it is a good one too ;-).  Did you manage to solve this issue: when a user change some of his information but not is email, the validation return an error because the email is already used (email value display on form = email stored in the repository).  so basically if we take the assumption that the username cannot change once a user is created, any update operation could validate against it. So if a user update his profile,  2 pieces of information need to be sent over the server  email + username when the email field validation occurs. So if the email value sent for uniqueness validation match the current username no error message should be triggered.</description>
		<content:encoded><![CDATA[<p>Hi Adrian,<br />
it is a good one too <img src='http://devermind.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> .  Did you manage to solve this issue: when a user change some of his information but not is email, the validation return an error because the email is already used (email value display on form = email stored in the repository).  so basically if we take the assumption that the username cannot change once a user is created, any update operation could validate against it. So if a user update his profile,  2 pieces of information need to be sent over the server  email + username when the email field validation occurs. So if the email value sent for uniqueness validation match the current username no error message should be triggered.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Adrian Grigore</title>
		<link>http://devermind.com/aspnet-mvc/asp-net-mvc-tip-3-how-to-cover-all-your-client-side-form-validation-needs-without-writing-any-javascript-part1/comment-page-1/#comment-379</link>
		<dc:creator>Adrian Grigore</dc:creator>
		<pubDate>Fri, 11 Dec 2009 15:26:41 +0000</pubDate>
		<guid isPermaLink="false">http://devermind.com/?p=152#comment-379</guid>
		<description>Good point, Olivier. I&#039;ve noticed this problem when working on my current project too since I wrote the article. Note that you can also get away without using form ids:

var validator=$(wrappedElement[0]).closest(&quot;form&quot;).validate();</description>
		<content:encoded><![CDATA[<p>Good point, Olivier. I&#8217;ve noticed this problem when working on my current project too since I wrote the article. Note that you can also get away without using form ids:</p>
<p>var validator=$(wrappedElement[0]).closest(&#8221;form&#8221;).validate();</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Olivier</title>
		<link>http://devermind.com/aspnet-mvc/asp-net-mvc-tip-3-how-to-cover-all-your-client-side-form-validation-needs-without-writing-any-javascript-part1/comment-page-1/#comment-378</link>
		<dc:creator>Olivier</dc:creator>
		<pubDate>Thu, 10 Dec 2009 21:23:19 +0000</pubDate>
		<guid isPermaLink="false">http://devermind.com/?p=152#comment-378</guid>
		<description>Hi Adrian,
it is very nice piece of work.
 I&#039;ve just encounter an issue when you get a page with multiple forms. you get an javascript error on the call of jquery.validate. To fix it I&#039;ve change  $(&quot;form&quot;).validate().element(wrappedElement); by  $(&quot;#&quot; + element.form.id).validate().element(wrappedElement); . Obviously you need to id your forms.</description>
		<content:encoded><![CDATA[<p>Hi Adrian,<br />
it is very nice piece of work.<br />
 I&#8217;ve just encounter an issue when you get a page with multiple forms. you get an javascript error on the call of jquery.validate. To fix it I&#8217;ve change  $(&#8221;form&#8221;).validate().element(wrappedElement); by  $(&#8221;#&#8221; + element.form.id).validate().element(wrappedElement); . Obviously you need to id your forms.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dan</title>
		<link>http://devermind.com/aspnet-mvc/asp-net-mvc-tip-3-how-to-cover-all-your-client-side-form-validation-needs-without-writing-any-javascript-part1/comment-page-1/#comment-377</link>
		<dc:creator>Dan</dc:creator>
		<pubDate>Mon, 30 Nov 2009 10:40:24 +0000</pubDate>
		<guid isPermaLink="false">http://devermind.com/?p=152#comment-377</guid>
		<description>Hi Adrian,

Great post, however I also would give my right arm for the &#039;validating entire business entities &#039; post !!!

All the best.</description>
		<content:encoded><![CDATA[<p>Hi Adrian,</p>
<p>Great post, however I also would give my right arm for the &#8216;validating entire business entities &#8216; post !!!</p>
<p>All the best.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shayne</title>
		<link>http://devermind.com/aspnet-mvc/asp-net-mvc-tip-3-how-to-cover-all-your-client-side-form-validation-needs-without-writing-any-javascript-part1/comment-page-1/#comment-375</link>
		<dc:creator>Shayne</dc:creator>
		<pubDate>Wed, 25 Nov 2009 17:40:49 +0000</pubDate>
		<guid isPermaLink="false">http://devermind.com/?p=152#comment-375</guid>
		<description>Regarding this: “This approach only works for Validation Attributes applied to properties, not to entire business entities. I’ll discuss a similar approach for validating entire business entities next week in the second part of this article.”

I too am patiently waiting for the follow-up article. Please find some time to post it Adrian.

Thanks for the brilliant work so far!</description>
		<content:encoded><![CDATA[<p>Regarding this: “This approach only works for Validation Attributes applied to properties, not to entire business entities. I’ll discuss a similar approach for validating entire business entities next week in the second part of this article.”</p>
<p>I too am patiently waiting for the follow-up article. Please find some time to post it Adrian.</p>
<p>Thanks for the brilliant work so far!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Adrian Grigore</title>
		<link>http://devermind.com/aspnet-mvc/asp-net-mvc-tip-3-how-to-cover-all-your-client-side-form-validation-needs-without-writing-any-javascript-part1/comment-page-1/#comment-368</link>
		<dc:creator>Adrian Grigore</dc:creator>
		<pubDate>Tue, 27 Oct 2009 23:18:48 +0000</pubDate>
		<guid isPermaLink="false">http://devermind.com/?p=152#comment-368</guid>
		<description>Thanks for the detailed upgrading list, Glen! I&#039;m sure it will come in handy when I upgrade to ASP.NET MVC 2 :-)</description>
		<content:encoded><![CDATA[<p>Thanks for the detailed upgrading list, Glen! I&#8217;m sure it will come in handy when I upgrade to ASP.NET MVC 2 <img src='http://devermind.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Glenn</title>
		<link>http://devermind.com/aspnet-mvc/asp-net-mvc-tip-3-how-to-cover-all-your-client-side-form-validation-needs-without-writing-any-javascript-part1/comment-page-1/#comment-367</link>
		<dc:creator>Glenn</dc:creator>
		<pubDate>Tue, 27 Oct 2009 18:55:54 +0000</pubDate>
		<guid isPermaLink="false">http://devermind.com/?p=152#comment-367</guid>
		<description>Aha!  I incorrectly assumed that since I stepped through the process in the debugger and there was no exception, the method returned a result properly.  However, when I directly accessed the validator, this is what greeted me:

This request has been blocked because sensitive information could be disclosed to third party web sites when this is used in a GET request. To allow GET requests, set JsonRequestBehavior to AllowGet.

Brand new in MVC2.  Sadly I even remember reading about that (potential security vulnerability) and didn&#039;t consider it.

So, allow me to give you step #6 that seems to get the property validation working in VS2010 Beta 2 / MVC2:

6.  On RemoteValidationController, change the return for both Property and Entity to use the overloaded Json method that allows you to bypass the new security check, like this:

            return Json(validator.IsValid(Request[&quot;value&quot;]), JsonRequestBehavior.AllowGet);</description>
		<content:encoded><![CDATA[<p>Aha!  I incorrectly assumed that since I stepped through the process in the debugger and there was no exception, the method returned a result properly.  However, when I directly accessed the validator, this is what greeted me:</p>
<p>This request has been blocked because sensitive information could be disclosed to third party web sites when this is used in a GET request. To allow GET requests, set JsonRequestBehavior to AllowGet.</p>
<p>Brand new in MVC2.  Sadly I even remember reading about that (potential security vulnerability) and didn&#8217;t consider it.</p>
<p>So, allow me to give you step #6 that seems to get the property validation working in VS2010 Beta 2 / MVC2:</p>
<p>6.  On RemoteValidationController, change the return for both Property and Entity to use the overloaded Json method that allows you to bypass the new security check, like this:</p>
<p>            return Json(validator.IsValid(Request["value"]), JsonRequestBehavior.AllowGet);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Glenn</title>
		<link>http://devermind.com/aspnet-mvc/asp-net-mvc-tip-3-how-to-cover-all-your-client-side-form-validation-needs-without-writing-any-javascript-part1/comment-page-1/#comment-366</link>
		<dc:creator>Glenn</dc:creator>
		<pubDate>Tue, 27 Oct 2009 18:37:03 +0000</pubDate>
		<guid isPermaLink="false">http://devermind.com/?p=152#comment-366</guid>
		<description>Thanks Adrian, I look forward to it!  FYI, after my post I realized your attached solution was different than what your post covered..  Unfortunately it didn&#039;t work when I used it in VS 2010 Beta 2 (I know, far from surprising, but wanted you to know).

FYI, here&#039;s what I did to get it to compile in VS2010 Beta 2:

1.  Used the solution converter here (to upgrade from MVC to MVC2):  http://weblogs.asp.net/leftslipper/archive/2009/10/19/migrating-asp-net-mvc-1-0-applications-to-asp-net-mvc-2.aspx

2.  Opened the solution in VS2010 beta 2, went thru the usual conversion; indicated I wanted to upgrade sites to ASP.NET 4.

3.  Removed the System.ComponentModel.DataAnnotations DLL from /bin

4.  Updated the reference for xVal to my local copy of 0.8 (same version as the project)

5.  ValidationAttribute.TryValidate, referenced a few times in DataAnnotationsModelBinder, is no longer in the API; I updated to use ValidationAttribute.GetValidationResult (the rest of the code was self explanatory)

After all of this work, I was left in the same spot I was previously with VS2010 Beta 2- the remotevalidationrule is constructed on the client when the field is first asked to be validated, a response is sent to the server, the server responses, and then...  nothing..  Nada.  I even changed the controller&#039;s response to simply return a JsonResult of false to bypass the logic, breakpoint shows that is happening, but nothing happens on the client.  Note the other client-side rules fire just fine.

Oh well.  Thus is the price of bleeding edge technology.</description>
		<content:encoded><![CDATA[<p>Thanks Adrian, I look forward to it!  FYI, after my post I realized your attached solution was different than what your post covered..  Unfortunately it didn&#8217;t work when I used it in VS 2010 Beta 2 (I know, far from surprising, but wanted you to know).</p>
<p>FYI, here&#8217;s what I did to get it to compile in VS2010 Beta 2:</p>
<p>1.  Used the solution converter here (to upgrade from MVC to MVC2):  <a href="http://weblogs.asp.net/leftslipper/archive/2009/10/19/migrating-asp-net-mvc-1-0-applications-to-asp-net-mvc-2.aspx" rel="nofollow">http://weblogs.asp.net/leftslipper/archive/2009/10/19/migrating-asp-net-mvc-1-0-applications-to-asp-net-mvc-2.aspx</a></p>
<p>2.  Opened the solution in VS2010 beta 2, went thru the usual conversion; indicated I wanted to upgrade sites to ASP.NET 4.</p>
<p>3.  Removed the System.ComponentModel.DataAnnotations DLL from /bin</p>
<p>4.  Updated the reference for xVal to my local copy of 0.8 (same version as the project)</p>
<p>5.  ValidationAttribute.TryValidate, referenced a few times in DataAnnotationsModelBinder, is no longer in the API; I updated to use ValidationAttribute.GetValidationResult (the rest of the code was self explanatory)</p>
<p>After all of this work, I was left in the same spot I was previously with VS2010 Beta 2- the remotevalidationrule is constructed on the client when the field is first asked to be validated, a response is sent to the server, the server responses, and then&#8230;  nothing..  Nada.  I even changed the controller&#8217;s response to simply return a JsonResult of false to bypass the logic, breakpoint shows that is happening, but nothing happens on the client.  Note the other client-side rules fire just fine.</p>
<p>Oh well.  Thus is the price of bleeding edge technology.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
