• Resolved mtgagents2021

    (@mtgagents2021)


    Hi,

    Can someone tell me how to remove the comma separator between value.

    For example current selector output is one, two, three … I want it to just be one two three .. no comma in-between each value.

    Can’t figure it out and haven’t found solution online.

    If it can be done, can it be targeted to one single element not the entire form ?

    Thanks

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Takayuki Miyoshi

    (@takayukister)

    Thread Starter mtgagents2021

    (@mtgagents2021)

    Can this function be used to target text, select or radio button input and not numeric ?

    Thanks

    Thread Starter mtgagents2021

    (@mtgagents2021)

    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

    Thread Starter mtgagents2021

    (@mtgagents2021)

    @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.

    Thread Starter mtgagents2021

    (@mtgagents2021)

    Still waiting for clarification on REMOVING the comma from checkbox and select outputs ?

    Hareesh S

    (@hareesh-pillai)

    You could try using a function like str_replace() for this.
    Reference: https://www.tutorialspoint.com/remove-comma-from-a-string-in-php

    Thread Starter mtgagents2021

    (@mtgagents2021)

    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 !! –

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Remove comma value seperator’ is closed to new replies.