Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
Apfelstrudel Posted July 8, 2016 Posted July 8, 2016 Hi, I have a small problem. Just trying to add my own database display template. Now I want to show the value of a radio button field. When I use {$record->customFieldDisplayByKey('record_key', 'value')|raw} it also shows me the title of the field. When I use 'raw' instead of 'value' it only shows me the key of the chosen radio item BUT I want the value of it. Example: Field: "For Sale" Radio 1: "Yes" Radio 2: "No" {$record->customFieldDisplayByKey('record_key', 'value')|raw} -> For Sale: Yes {$record->customFieldDisplayByKey('record_key', 'raw')|raw} -> yes I just want -> Yes What am I doing wrong?
opentype Posted July 8, 2016 Posted July 8, 2016 Set Listing View Format to “custom” and then add this in the field below: {{if $formValue}} {$value} {{endif}} This overrides the default behavior of showing the label.
Apfelstrudel Posted July 8, 2016 Author Posted July 8, 2016 This solution doesn't work. I still have the same problem. I don't use the standard db display template. I have to make my own. So I need the right variable to show the value without the label. I don't understand why value doesn't contain the value only. Any other ideas how to output the radio value only? But as I can see this problem only comes up with advanced fields, like radio button fields, maps. It does work with standard text fields.
opentype Posted July 8, 2016 Posted July 8, 2016 33 minutes ago, Apfelstrudel said: This solution doesn't work. It works. I’m sure. If it doesn’t work for you, you didn’t call the it the right way. The custom field code will be used by the field default loop or by the default manual call, e.g. 'my_key', 'listing'. Make sure to use the proper call as described in the field settings. Note the “listing” and “display” depending on the template you are in.
Apfelstrudel Posted July 8, 2016 Author Posted July 8, 2016 Great. I forgot to replace value by display. Last question: How can I place the map into the custom template? Here I have {$record->customFieldDisplayByKey('my_key', 'map')|raw}
opentype Posted July 8, 2016 Posted July 8, 2016 50 minutes ago, Apfelstrudel said: Last question: How can I place the map into the custom template? Just like any other field – call it by it’s name. Unless you want to customize it. Then I would do that as described above in the field settings.
Apfelstrudel Posted July 8, 2016 Author Posted July 8, 2016 Nope, it shows the address only but no map.
opentype Posted July 8, 2016 Posted July 8, 2016 Lesen hilft. ;-) Those calls are for the custom field. You don’t need to change anything in your template.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.