Checkbox choice options displayed as list?

kapearl

Member
I have a checkbox custom join field with about 8 choice field options. Anyone who fills out at least one will fill out a few if not all.

Is there a way to get the results in a list vs item 1, item 2, item 3, item 4 (items separated by comma)? Eventually I'd like to have each item be an icon or image in a horizontal row so I thought for now a list would be a good place to start. Thank for any advice.
 

Basti

Administrator
Staff member
Easiest way is to create a plugin for that, and make an array out of the tmpl tag and then loop through each item and alter it, something like
Code:
$tmp_items = explode(', ', $TMPL['my_field_tag']);

$TMPL['some_new_tag'] = '';
foreach ($tmp_items as $item) {

    $TMPL['some_new_tag'] .= '<span class="some-tag-to-target-this-element">some img and the text '.$item.'</span>';

}
 

kapearl

Member
Thanks Basti. I ran into a glitch with the checkboxes while attempting this. They don't stay checked. I edit my account and check them all off. When I go back and edit again, they are unchecked!

I was able to reproduce the checked data on a profile page so the data is saved but the checked status doesn't seem to be.
 

Basti

Administrator
Staff member
They don't stay checked. I edit my account and check them all off. When I go back and edit again, they are unchecked!
Did you wrongly wrote that in bold? i suppose so

I would need to look at it, maybe something custom conflicting with it.
But hard to say. Dont think i got your ftp details anymore, so if you could pm me them and ill have a look
 

kapearl

Member
Hmmm, I didn't bold anything or see that. Weird. "Check them all off" isn't important.

I'll send you the info. Thank!
 

Basti

Administrator
Staff member
You wrote
I edit my account and check them all off. When I go back and edit again, they are unchecked!
I added the bold in there, in the quote.
You uncheck the checkboxes -> save, and go back and they are unchecked. Thats how it works lol. Thats why i asked if you mistyped
 

Basti

Administrator
Staff member
Ok i have the found the error. As soon as someone has 2 custom fields as checkbox, the the last checked values are used from the previous checkbox. In your case PR. And because the value was now the one from PR, nothing is checked when you revisit edit page

I swear i had that fixed before in VL. This sounds so familar, another one of those mysterious gone edits

Anyway, ill update your list with it since im logged already and this will go into VL for next version ( again? hmm, hopefully stays this time :p )
 
Top