Jump to content

Optional Database Field Template View


jhutch

Recommended Posts

Posted

So I've got several fields in my database that I'm not requiring my staff to fill out. So it's an optional database field, essentially. 

When it comes to displaying this on the front end - can someone tell me the "Custom Display Format" that would hide this field if nothing is filled in. Then display the field if the staff member had put content into that optional database field.

Thanks! 

Posted
18 minutes ago, opentype said:

{{if $formValue}}

{{endif}}

 

Though this does seem to work - it still leaves a space (<br>) even though there is no data displayed. Is there a way to eliminate it?

Posted
{$record->customFieldDisplayByKey('2015', 'display')|raw}
    <br>
{$record->customFieldDisplayByKey('2014', 'display')|raw}
    <br>
{$record->customFieldDisplayByKey('2013', 'display')|raw}
    <br>
{$record->customFieldDisplayByKey('2012', 'display')|raw}
    <br>
{$record->customFieldDisplayByKey('2011', 'display')|raw}

This is what I have showing on the template ^^^

Then below is what I have on the "Display Custom Format" inside the database field settings...

{{if $formValue}}<b>{$label}:</b> {$value}{{endif}}                   - this is the same for each field listed above, (2015, 2014, 2013, 2012, 2011)

Archived

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

  • Recently Browsing   0 members

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