jhutch Posted December 14, 2015 Share Posted December 14, 2015 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! Link to comment Share on other sites More sharing options...
opentype Posted December 14, 2015 Share Posted December 14, 2015 {{if $formValue}} {{endif}} Link to comment Share on other sites More sharing options...
jhutch Posted December 14, 2015 Author Share Posted December 14, 2015 Thanks!! Link to comment Share on other sites More sharing options...
jhutch Posted December 14, 2015 Author Share Posted December 14, 2015 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? Link to comment Share on other sites More sharing options...
opentype Posted December 14, 2015 Share Posted December 14, 2015 Probably, but hard to say where this is coming from without looking at all the involved templates and settings. Link to comment Share on other sites More sharing options...
jhutch Posted December 14, 2015 Author Share Posted December 14, 2015 {$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) Link to comment Share on other sites More sharing options...
opentype Posted December 14, 2015 Share Posted December 14, 2015 Oh, I see. You put the break in there yourself! ;-) Just make it part of the IF statement then, e.g. {{if $formValue}}<b>{$label}:</b> {$value}<br>{{endif}} Link to comment Share on other sites More sharing options...
jhutch Posted December 16, 2015 Author Share Posted December 16, 2015 That makes too much sense. Thanks @opentype - definitely nice to have a second eye on things. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.