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?
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 |
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.
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.
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 />" />
<field name="Field Name" separator="<br />" />
Okay, that didn't work either. Let's just do this:http://www.sixeightmedia.net/blog/data-display-separator-for-fields...
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!
Cool!
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
But you could do:
I'm looking at developing a <foreach></foreach> element to make this process a little easier.