Skip to content

Instantly share code, notes, and snippets.

@Shelob9
Last active May 2, 2017 21:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Shelob9/0f201b8e6a108e35a9a5fd49dcd24193 to your computer and use it in GitHub Desktop.
Save Shelob9/0f201b8e6a108e35a9a5fd49dcd24193 to your computer and use it in GitHub Desktop.
jQuery( document ).ready( function ($ ) {
$( document ).on( 'cf.validate.fieldError', function( event, obj ){
//make field fld123456 always validate false
if( 'fld123456' === obj.el.data( 'field' ) ){
obj.inst.validationResult = false;
}
});
});
jQuery( document ).ready( function ( $ ) {
/**Run JavasScript when a Caldera Forms field is unsuccessfully validated!**/
$( document ).on( 'cf.validate.fieldError', function( event, obj ){
//make valid
obj.inst.validationResult = true;
});
/** Run JavasScript when a Caldera Forms field is successfully validated!**/
$( document ).on( 'cf.validate.fieldSuccess', function( event, obj ){
///make invalid
obj.inst.validationResult = false;
});
/** Run JavasScript when a Caldera Forms form is successfully validated!**/
$( document ).on( 'cf.validate.FormSuccess', function( event, obj ){
///make invalid
obj.inst.validationResult = false;
});
/**Run JavasScript when a Caldera Forms form is unsuccessfully validated!**/
$( document ).on( 'cf.validate.FormError', function( event, obj ){
//make valid
obj.inst.validationResult = true;
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment