Last active
December 19, 2016 01:23
-
-
Save Shelob9/46f6798e2e722532c57897ccb2930ec5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'caldera_forms_validate_field_dropdown', function( $value, $field, $form ){ | |
//return if not a specific form -- UPDATE form ID please! | |
if( 'cf1234567' != $form[ 'ID' ] ){ | |
return $value; | |
} | |
if( 'Han Solo' == $value ) { | |
return new WP_Error( $field[ 'ID' ], 'Sorry we are sold out of Han Solo dolls right now.' ); | |
} | |
return $value; | |
}, 25, 3 ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'caldera_forms_validate_field_text', function( $value ){ | |
if( 8 < strlen( $value ) ){ | |
return new WP_Error( '', 'Input must be longer!' ); | |
} | |
return $value; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment