Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Set a custom validation error message for one Caldera Forms field See: https://calderaforms.com/doc/caldera_forms_field_attributes/
<?php
/**
* Set a custom validation error message for one Caldera Forms field
*/
add_filter( 'caldera_forms_field_attributes', function($attrs, $field){
//IMPORTANT - Change your field ID
if ( 'fld1234' === $field[ 'ID'] ) {
$attrs[ 'data-parsley-error-message' ] = 'You must enter a number between 42 and 88';
}
return $attrs;
}, 10, 2 );
@TradeFidotcom
Copy link

TradeFidotcom commented Nov 3, 2020

Hello, is there list of attrs which can be set using filter caldera_forms_field_attributes. Also which source file govern just for reference?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment