BN_IT_Support Posted July 28, 2016 Share Posted July 28, 2016 What's wrong with this please? {{if $record->customFieldDisplayByKey('offer_title')}} <span class='ipsType_light ipsType_reset ipsType_large'> <a href="{$record->container()->url()}" title="Country"> <i class="fa fa-globe" aria-hidden="true"></i> {$record->container()->_title}</a> </span> {{endif}} I'm trying to display a DB field in a DB template only if the field has a value. But this displays all the time irrespective of whether there is anything in 'offer_title'. Link to comment Share on other sites More sharing options...
opentype Posted July 28, 2016 Share Posted July 28, 2016 What’s the type of this field? Link to comment Share on other sites More sharing options...
BN_IT_Support Posted July 28, 2016 Author Share Posted July 28, 2016 text Link to comment Share on other sites More sharing options...
opentype Posted July 28, 2016 Share Posted July 28, 2016 Try the specific template call, like so: {{if $record->customFieldsForDisplay('display')['your_field_name']}} {{endif}} That should work for text fields. (My preferred method is to move the the check into the field settings and check for $formValue. That works for more field types.) Link to comment Share on other sites More sharing options...
BN_IT_Support Posted July 28, 2016 Author Share Posted July 28, 2016 Perfect! Thank you. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.