Can this function be used to target text, select or radio button input and not numeric ?
Thanks
Your example seems to be adding the comma not removing it!
I have checkbox and select inputs that I want to appear WITHOUT commas between the different options on the output.
Can you please advise what the changes would be to the code in the link you sent. I cannot figure it out and there is little examples online other than for number inputs.
Thanks
@takayukister Can you provide some clarification on removing the comma from checkbox or select outputs please as the link appears to show adding the comma only for numeric ouput’s.
An answer might help the community more in the future.
Still waiting for clarification on REMOVING the comma from checkbox and select outputs ?
You could try using a function like str_replace()
for this.
Reference: https://www.tutorialspoint.com/remove-comma-from-a-string-in-php
add_filter( 'wpcf7_mail_tag_replaced',
function( $replaced, $submitted, $html, $mail_tag ) {
// only use a specific field
if ( 'your-fruit' == $mail_tag->field_name() ) {
// create a string from the $submitted array
$new_string = implode(',', $submitted);
// now replace the commas in the new string
$replaced = str_replace(',',' ', $new_string );
}
// return the updated field
return $replaced;
},
10, 4
);
This is the code to remove the comma !! –