Created
July 17, 2017 14:46
-
-
Save Shelob9/869d0ebb94b017ca690ed70c5aa7431a to your computer and use it in GitHub Desktop.
Set a custom validation error message for one Caldera Forms field See: https://calderaforms.com/doc/caldera_forms_field_attributes/
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 | |
/** | |
* 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 ); |
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
It would appear the checkbox does not accept
data-parsley-error-message
as an attribute. Even with this filter it's still renderingparsley-required
.It also appears substituting
$attrs[ 'parsley-required' ]
doesn't help.