I'm building a table that shows the options people chose for a Checkbox field, like this:
[if 898 like="Capacity"]<span class="checkmark">Yes</span>[/if 898]
[if 898 like="Finances"]<span class="checkmark">Yes</span>[/if 898] etc.
but the field includes an Other option, and I'm trying to figure out how to display ONLY the value for Other.
I'm thinking I'll need to write a custom shortcode for this, but just wondered if I'm missing some other answer.
Thanks!
When I look at the HTML of the form containing one of these Checkbox fields, I can see that the name of the Other field is:
item_meta[other][942][other_10]
It's looking like I need a custom shortcode to extract this data or does anyone know of an existing shortcode that does this. I haven't found one in the documentation.
I've read this multiple times and honestly, I'm still not sure what you're trying to do. That being said, I'll answer based on my own assumptions. Assuming "building a table" means you're in a view, I suggest a custom shortcode that uses a switch statement for the hardcoded values in the list and the default case for the "other". I'm not sure if you realize that the value in [898] in the Other case is whatever value the user entered, so that all you really know is that it's not Capacity, not Finances etc. The provided example is odd in that in both the Capacity and Finances case, you're outputting the same value, though I guess you meant to put a label in there as well.
Hi Rob!
I've only ever spit out Other values as part of spitting out all the checkbox values. In this instance, we're separating each checkbox value into a column, so I needed to isolate the Other value. I was thinking that when the checkbox values are stored, that there was some sort of flag to say "this is the Other value", but when I checked in the database, it does not. So, as you say, what I have to do in my custom code, is loop through all the checkbox values, and the one that doesn't match any of the hard-coded values must be the Other value.
Thanks!
Please login or Register to submit your answer