caldera_forms_save_field


This filter runs before the entry is saved, but after the submission is validated and all processors are run. This is an excellent filter to use when you want to modify submission data or use submission data for some other purpose, but only on a valid submission.

add_filter( 'caldera_forms_save_field', function( $entry, $field ) {
    //check if is the right field here
    if( 'fld1234' == $field[ 'ID' ] && is_string( $entry )  ) {
        //format entry -- in this case remove dollar sign and strip whitespace
        $entry = str_replace( '$', '', $entry );
        $entry = trim( $entry );
    }

    return $entry;
}, 10, 2);

Where Does This Code Go?

When using WordPress hooks to customize Caldera Forms or other plugins you should not modify the plugin files, or you will lose your changes when you update the plugin. Instead you should create a small plugin to hold the custom code. It's easy, learn how here.

Technically you can add the custom code to your theme's functions.php, but then you will not be able to change your theme and keep these customizations.

Learn More