Multiple Dropdown Options for Front-end Display

Support MB Frontend Submission Multiple Dropdown Options for Front-end Display

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #43083
    johnsonmr90@gmail.com[email protected]
    Participant

    Hi there,

    So I have a dropdown list in a front-end submission form that allows users to choose their office location. However, when they select multiple locations, there's no separator, so the output is something like this when I call the field for use:

    "Proudly Serving: West ColonialEast ColonialWinter ParkOnline Clients"

    Is there a way to get comma separation (with a space) if there is another item in the list present? Such that the output would then be:
    "Proudly Serving: West Colonial, East Colonial, Winter Park, Online Clients"
    (bonus points if there's a way to detect the last item in the list and and an '&' in front of it such that it would be _____, ____ & ____)

    Thanks!

    #43089
    PeterPeter
    Moderator

    Hello Johnson,

    How do you output the select field value? When using the loop to output the value, you can add a space between items. For example:

    $values = rwmb_meta( 'my_field_id' );
    foreach ( $values as $value ) :
        echo $value . ' ';
    endforeach
    

    Refer to the documentation https://docs.metabox.io/fields/select/

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.