<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="http://syndication.webwiz.co.uk/rss_namespace/">
 <channel>
  <title>DevForce Community Forum : Validation</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : Community Forum : Validation</description>
  <pubDate>Fri, 10 Apr 2026 20:27:31 -700</pubDate>
  <lastBuildDate>Mon, 01 Oct 2012 22:59:54 -700</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 9.69</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>www.ideablade.com/forum/RSS_post_feed.asp?TID=3662</WebWizForums:feedURL>
  <image>
   <title>DevForce Community Forum</title>
   <url>http://www.ideablade.com/forum/forum_images/IdeaBlade_logo_tm.png</url>
   <link>http://www.ideablade.com/forum/</link>
  </image>
  <item>
   <title>Validation : Theunderlying model properties...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3662&amp;PID=14683#14683</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1522" rel="nofollow">pierom</a><br /><strong>Subject:</strong> 3662<br /><strong>Posted:</strong> 01-Oct-2012 at 10:59pm<br /><br />The&nbsp;<span style=": rgb251, 251, 253; ">underlying model properties are numbers (int32).</span><div><span style=": rgb251, 251, 253; ">The problem arises when the viewmodel is bind with ko to a view (text editors). The values returned from the bind are strings &nbsp;so the default validator without allowString=true failed.&nbsp;</span></div><div><span style=": rgb251, 251, 253; ">With your last update I substitute the default validator for every involved property. Not a big problem except that I have about 300 int32 properties!</span></div>]]>
   </description>
   <pubDate>Mon, 01 Oct 2012 22:59:54 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3662&amp;PID=14683#14683</guid>
  </item> 
  <item>
   <title>Validation : We hadn&amp;#039;t thought about replacing...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3662&amp;PID=14682#14682</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1524" rel="nofollow">jtraband</a><br /><strong>Subject:</strong> 3662<br /><strong>Posted:</strong> 01-Oct-2012 at 4:24pm<br /><br />We hadn't thought about replacing the standard numeric validators with custom validators with the same names but providing this ability IS a good idea.&nbsp; We'll try to get something like this into one of the next few releases.<br><br>Of course, right now you can remove any validator from any validators collection and add a new custom one yourself.<br><br>What we didn't understand from your original post was what the underlying data model looks like for this app.&nbsp; Are the underlying model properties numbers or strings?&nbsp; I am assuming they must be strings in which case you must be adding the 'numeric-allowString' validators yourself on the client.&nbsp; Numeric validators will only get added automatically if the data type of the property is actually numeric, in which case, I didn't understand how a 'numeric-allowString' validator would ever work for you.<br><br>Not sure how clear this answer was. :)]]>
   </description>
   <pubDate>Mon, 01 Oct 2012 16:24:26 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3662&amp;PID=14682#14682</guid>
  </item> 
  <item>
   <title>Validation : I noticed that in version 0.60...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3662&amp;PID=14674#14674</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1522" rel="nofollow">pierom</a><br /><strong>Subject:</strong> 3662<br /><strong>Posted:</strong> 01-Oct-2012 at 5:11am<br /><br />I noticed that in version 0.60 was implemented "allowstring = true" for int32 validator.<div><br></div><div>Is it possibile to set this option for the default int32 validator instead to assign it for every properties?&nbsp;</div><div><br></div><div>In the documentation you write:</div><div><ul style="margin: 0px 0px 16px; padding: 0px; border: 0px; outline: 0px; vertical-align: line; font: inherit; list-style: n&#111;ne; font-family: 'Segoe UI', 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, sans-serif; color: rgb68, 68, 68; line-height: 20px; "><li style="margin: 0px 0px 0px 25px; padding: 0px; border: 0px; outline: 0px; vertical-align: line; font: inherit; list-style: disc; ">var myValidator = Validator.number( { allowString: true}))</li><li style="margin: 0px 0px 0px 25px; padding: 0px; border: 0px; outline: 0px; vertical-align: line; font: inherit; list-style: disc; ">myProp.validators.push(myValidator)</li></ul><div>But using "push" the validator is added instead of replaced. So the previous one remains active and the validation fails the same.</div></div><div>I use: MyProp.validators&#091;0&#093;=myValidator.</div><div><br></div><div><br></div>]]>
   </description>
   <pubDate>Mon, 01 Oct 2012 05:11:51 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3662&amp;PID=14674#14674</guid>
  </item> 
  <item>
   <title>Validation :   We like your idea of being...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3662&amp;PID=14591#14591</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=482" rel="nofollow">WardBell</a><br /><strong>Subject:</strong> 3662<br /><strong>Posted:</strong> 25-Sep-2012 at 12:25pm<br /><br />We like your idea of being able to apply a numeric validation to a string value; we'll implement this shortly; keep your eye on the release notes (we're releasing small improvements every few days it seems).<div>&nbsp;</div><div>We know from metadata when a "field" is numeric. We might think about extending our KO tracking implementation so that it generates KO observables that are&nbsp;extended in the <a href="http://knockoutjs.com/&#100;ocumentati&#111;n/extenders.html" target="_blank">manner you describe as is suggested by the KO documentation</a>. Maybe offer a&nbsp;plugin point so you could define how you want to generate the&nbsp;KO properties for numerics.</div><div>&nbsp;</div><div>You could try this yourself. One of the beauties of the adapter pattern is that you can take our&nbsp;adapter and roll your own variation.</div><div>&nbsp;</div><div>On the other hand,&nbsp;the current metadata do not capture the numeric field's precision nor how it should be rounded and this kind of intervention at such a deep level seems intrusive.</div><div>&nbsp;</div><div>Another option: Breeze will soon have a post-create method that you can define to do anything to entities <em>immediately after</em> they are created or materialized by a query. That could be a place for you to put your own utility to extend the numeric KO properties based on your own model-specific reasoning.&nbsp; I think we'd lean that way for now.</div>]]>
   </description>
   <pubDate>Tue, 25 Sep 2012 12:25:32 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3662&amp;PID=14591#14591</guid>
  </item> 
  <item>
   <title>Validation : I have many int32 entity properties....</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3662&amp;PID=14586#14586</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1522" rel="nofollow">pierom</a><br /><strong>Subject:</strong> 3662<br /><strong>Posted:</strong> 25-Sep-2012 at 10:40am<br /><br />I have many int32 entity properties. Binding to input fields they are converted to string when modified so the validation fails.<div>Browsing the web I found that this is a problem using ko.</div><div>The first solution I found was implement a ko extenders (copied from thei site):</div><div><b>&nbsp;ko.extenders.numeric = function (target, precision) { ....</b></div><div>and apply to all numeric fields before save:</div><div><br></div><div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;function salva() {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (em.hasChanges()) {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <b>oModelRuntime.RIGHE_VISIBILI_AP.extend({ numeric: 0 });</b></div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var isValid = oModelRuntime.entityAspect.validateProperty("RIGHE_VISIBILI_AP");</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; alert(isValid);</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; em.saveChanges()</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .then(function (saveResult) {</div><div>But I have hundreds of fields to apply the extender.</div><div>The second, and for me best, solution was to modify your source:</div><div><br></div><div><div>&nbsp; &nbsp; &nbsp; &nbsp; function intRangeValidatorCtor(validatorName, minValue, maxValue) {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ctor.messageTemplates&#091;validatorName&#093; = core.formatString("'%displayName%' must be an integer between the values of %1 and %2",</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; minValue, maxValue);</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return function () {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var valFn = function (v, ctx) {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (v == null) return true;</div><div><b>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (typeof v === "string") &nbsp;// added</b></div><div><b>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; v = parseInt(v, 0);</b></div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ((typeof v === "number") &amp;&amp; Math.floor(v) === v) {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (minValue != null &amp;&amp; v &lt; minValue) {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return false;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (maxValue != null &amp;&amp; v &gt; maxValue) {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return false;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return true;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } else {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return false;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; };</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return new ctor(validatorName, valFn);</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; };</div></div><div><br></div></div><div>Let me know if this is a correct approach except more refinements. If the property type is int32 (number) for me is logical that the validator try to convert if the input value is a string.</div>]]>
   </description>
   <pubDate>Tue, 25 Sep 2012 10:40:45 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3662&amp;PID=14586#14586</guid>
  </item> 
 </channel>
</rss>