developer | thinker | tinkerer

Quick ValidateThis Gotcha

  • Thursday, January 27 2011

This is 100% my mistake which I'm blaming on lack of sleep and caffiene.

But I thought I'd post it to help others who may run into this issue.

I was writing some new ValidateThis rules and one was not firing...  I assumed I was doing something wrong in my rules file so I was trying all sorts of iterations with no success.

My rules looked like:

<property name="PID" desc="PID">
<rule type="required"
failureMessage="A PID is required if the provider is a university employee.">
<param name="DependentPropertyName" value="employeeTypeId">
<param name="DependentPropertyValue" value="1">

What I should have remembered  is:

  1. That ValidateThis writes both your server and client side validations (which is sooo nice!)
  2. The client side is done with jQuery
  3. And JavaScript is... case sensitive!

So if we revisit my ValidateThis rule I had:

<property name="PID" desc="PID"/>

But in my markup (I'm using cfUniForm) I had:

<uform:field label="PID" name="pid" type="text" .../>

Doh! Despite my best efforts PID != pid in JavaScript.

Simple Loading Dialog w/jQuery UI Wireframe Sketcher - A Better Alternative to Balsamiq?