Separators in display of values selected from multi-select form field

Permalink Browser Info Environment
One of my defined form fields("Category") is a multi-select box (Cat A, Cat B, etc..). Currently, the Data Display detail view outputs all user-selected values as a single text string with no separators between them. Ideally, I'd like to add a pipe or comma character between each listed value.

Apologies if this is a silly question. Seems like it should be easy, but the view.php template just seems to grab the full db value, and the DD template doesn't seem to offer a way to format discrete components within a single answer. Not sure where else I should be looking.

Any pointers?

Type: Discussion
Status: New
diorist
View Replies: View Best Answer
jgarcia replied on at Permalink Best Answer Reply
jgarcia
This isn't very well documented...

<field name="Field Name" separator=", " />


This would result in:
Option 1, Option 2, Option 3

...if the user specified Option 1, Option 2, and Option 3. The value of separator can be HTML, but it has to be entity encoded. So, you couldn't do

<field name="Field Name" separator="<br />" />


But you could do:

<field name="Field Name" separator="<br />" />


I'm looking at developing a <foreach></foreach> element to make this process a little easier.
diorist replied on at Permalink Reply
diorist
Zomg...perfect. Thanks, Justin!

This is what I love about Data Display. You've built it so that there's probably a fairly simple way to accomplish every reasonable thing I imagine for it.
jgarcia replied on at Permalink Reply
jgarcia
Oh and just a heads up...the last code section was changed when I posted it. Here it is without the code brackets (hopefully it works):

<field name="Field Name" separator="<br />" />
jgarcia replied on at Permalink Reply
jgarcia
Okay, that didn't work either. Let's just do this:http://www.sixeightmedia.net/blog/data-display-separator-for-fields...
diorist replied on at Permalink Reply
diorist
Got it: you just need to replace tag brackets with their respective entity codes. So, in theory, you could even add a span + css class for separator styling.

Cool!

concrete5 Environment Information

Browser User-Agent String

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You have not specified a license for this support ticket. You must have a valid license assigned to a support ticket to request a refund.