Jump to content

Value of record field?


Apfelstrudel

Recommended Posts

Posted

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?

Posted

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. 

Posted

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.

Posted
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. 

Bildschirmfoto 2016-07-08 um 16.31.38.png

Posted
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. 

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...