I was wondering if there was a way to correct the data after form submission ?
For example : One of my client wants to receive city name without hyphen, We use a google maps autocompletion plugin on this field and city names can have hyphens.
maybe using a function with “gform_save_field_value” ?
This code should work. There were some fancy quotes in there, but I am not sure if that is the forum software correcting that, or if that was in your code. Please try this:
// applies to form 1, field 24
add_filter( 'gform_save_field_value_1_24', 'remove_hyphen', 10, 5 );
function remove_hyphen( $value, $lead, $field, $form, $input_id ) {
// replace hyphens with spaces
$new_value = str_replace( '-', ' ', $value );
return $new_value;
}