OnBlur/mouseup validation

34 views
Skip to first unread message

Lynn Ebanks

unread,
Oct 29, 2014, 3:41:15 PM10/29/14
to valida...@googlegroups.com
Hello all!

I am a newbie to ValidateThis.  I have it set up and running on my first form.  It is awesome!

I noticed on the demo that the jquery validation happens onBlur or mouseup.  So far my validation only occurs on submit.  I'm not sure if I am just getting the server side validation only or if it is just a configuration issue.

Is there a configuration I am missing to get the jquery validation to work like the demo?

Thanks for a great framework, Bob!

John Whish

unread,
Oct 29, 2014, 3:46:39 PM10/29/14
to valida...@googlegroups.com
When you submit the form - does the page reload before you see the validation messages? If it does then it sounds like the JavaScript validation isn't working. I'd suggest you open up your browser console and look for any JS errors or 404 errors where it isn't loading a JS file.

--
You received this message because you are subscribed to the Google Groups "ValidateThis" group.
To unsubscribe from this group and stop receiving emails from it, send an email to validatethis...@googlegroups.com.
To post to this group, send email to valida...@googlegroups.com.
Visit this group at http://groups.google.com/group/validatethis.
For more options, visit https://groups.google.com/d/optout.

Lynn Ebanks

unread,
Oct 29, 2014, 4:37:45 PM10/29/14
to valida...@googlegroups.com

Yes John.  It is reloading the page as you described and then the messages appear below the form fields.  

I have this code below my form.  Do you think I have something else missing?
 #rc.Validator.getInitializationScript()#
  #rc.Validator.getValidationScript(formName="page-form", context=rc.context)#

When I look in the console I get the following error:
$.format has been deprecated. Please use $.validator.format instead.

I see the javascript when I view source.

Thanks for your response!

Lynn Ebanks

unread,
Oct 29, 2014, 8:30:38 PM10/29/14
to valida...@googlegroups.com
Hi John,

For some reason the jquery validation script was not in the head.  Is the framework supposed to automatically inject the link to the validation script's CDN?  It works when I put the link to the CDN right before the closing head tag.  I'll look more closely to see if there is a simple issue that I overlooked.

Thanks for all of your hard work on this framework!

John Whish

unread,
Oct 30, 2014, 6:57:26 AM10/30/14
to valida...@googlegroups.com
Hi Lynn,

It doesn't link to the CDN by default, it should link to the included JS files, although these are a little behind the current versions of jQuery and jQuery Validation  plugin. I generally use newer versions of those files than the bundled ones as jQuery is what I use anyway for other parts of the sites I work on and I can use Bower or something if I want to. 

So my setup would be something like:

Application.cfc...

var VTConfig = { definitionPath="/model/", JSIncludes=false };
var ValidateThis = new lib.ValidateThis.ValidateThis(VTConfig);

... stick it in the BeanFactory or Application scope depending on how you write your code


Then in  my views...

<!--- load JS assets from wherever --->
<script type="text/javascript" src="whatever/js/jquery.min.js"></script>
<script type="text/javascript" src="whatever/js/jquery.validate.min.js"></script>
<script type="text/javascript" src="whatever/js/jquery.field.min.js"></script>
<!--- customise jQuery Validation plugin settings --->
<script type="text/javascript">
jQuery(function($){
// set up validator defaults
jQuery.validator.setDefaults({
errorClass: 'field-error-message', 
validClass: 'field-isvalid',
errorElement: 'label'
});
});
</script>

#rc.Validator.getInitializationScript()#
#rc.Validator.getValidationScript(formName="page-form", context=rc.context)#

Lynn Ebanks

unread,
Nov 13, 2014, 2:44:20 PM11/13/14
to valida...@googlegroups.com
Hi John,

Sorry so long to get back to reply.  You are exactly right!  I see where my set up had the JSIncludes = false;  : )  Didn't notice the meaning behind that until later : ) Anyway, I have done exactly what you have listed below and it works perfectly!

Thank you so much for taking the time to help me!  I admire your work! 

Talk soon,
Lynn
Reply all
Reply to author
Forward
0 new messages