jQuery validate plugin is pretty awsome. However it doesn’t do everything. That’s why the plugin have the addMethod function. And I need to add an ajax duplicate check for an email input. Here’s the method i wrote. There might be a better way. I would love to know.
jQuery.validator.addMethod("checkForDupeEmail", function(value, element, param){
var ajaxFunc = $.ajax({
async:false,//we have to set it to false, it does not return a value before we even complete the request.
data:'email='+($.trim(value)),
type:'POST',
url:'/employees/ajax_checkDupe',
dataType:'text',
});//here we check the response
if(ajaxFunc.responseText ==1)
return >true;
else
return >false;});
[UPDATED to allow multiple instances] [UPDATED bug fix]
Hello everyone. The select tag that comes with html is pretty useful, but once in a while, one of your clients complains that it’s fugly. So you need to make a custom one. And that’s what i just did. Damned clients!
Requirements:
jquery
To do this you need to create a file called customSelect.ctp in your app/views/elements folder(Of course you don’t NEED cakephp to use this.).