title: parsley.js - custom validation for date field
body: <p>I have been reading the <a href="http://parsleyjs.org/" rel="nofollow">parsley.js docs</a> and I have tried to write a custom validator to validate if a date is greater than todays date.</p>
  
  <p>I have the conditional code written, but I am completly confused about how to apply the conditional error message.</p>
  
  <p>I have completed the task with a parsley maxlength validator, but realise that this is less than perfect.</p>
  
  <p><strong>How do I write the custom validation with parsley?</strong></p>
  
  <p>Here is my js/jq code that dynamically adds &amp; deletes the validation using the maxlength:</p>
  
  <pre><code>if(formattedStartDate &gt; todaysDate) {
  
      $('#id_voluntary_start_date').attr('data-parsley-maxlength', '1');
      $('#id_voluntary_start_date').attr('data-parsley-maxlength-message', '{% trans "Commencement Date must not be greater than today." %}');
      $('#id_voluntary_start_date').parsley();
  } else {
      $('#id_voluntary_start_date').attr('data-parsley-maxlength', '50');
  }
  </code></pre>
  
  <p>Any help with implementing the custom validation would be appreciated.</p>