How to include omit if blank on custom presenter

Hi all

We are building a custom presenter (actually editing the copy to clipboard presenter) we need to be able to ‘omit if blank’ but don’t know how to add this into our code. can anyone help?



Hi Kevin,

The simplest way to achieve this would be to add a setting in the main.js.

get_settings: function() {
        return {
            omit_if_blank : {
                main_label:"Omit if Blank",
                preset: 0

Add the setting to the get_template_data return:

return {
    get_template_data: function() {
        return {
            omit_if_blank : (presenter.get_setting('omit_if_blank') == 1 ? 1 : 0)

Next, you will want to add some logic either to your main.js or frontend.js to set a flag to omit the html under the condition that omit_if_blank is True and your value is null or empty.

hide = omit_if_blank && !value;

Then add a v-if attribute to any html tag in main.htm. This will show the contents of the div for as long as show is true.

<div v-if="!hide">
    Everything here is hidden when hide is false.

Hope this helps.

Thanks, will give it a go. @james.bovington lets try this next time you are in

Hi, thanks Adam. Your suggestion is for hiding elements within the presenter, but the standard ‘omit if blank’ setting that we’re refering to is a ‘fragment setting’ which should hide the whole field (i.e. including the field’s label) if there’s no data, and so it’s outside of the scope of the presenter’s html.
Hope that makes sense,

Thanks James,

You raise a very valid point, this will only make the field disappear and not the wrapper.
Let me raise this with core and I’ll get back to you.

1 Like

Hi James,

Have spoken with Core and have been asked to add it as an idea, as these are up for review imminently.

Please add your support and a comment.

Many Thanks

Thanks Adam!
@kevin.rowe can you vote on Adam’s idea too please?

Many thanks

Done @lee.newman @CraigBarker_Cumbria @steve.whitcher @hojm

Voted :slight_smile: @Karl @carro this will be handy can you give it a vote?

Morning Kevin,

In the rush up to Christmas, it appears I overlooked a vital detail here.

It appears the ‘omit if blank’ option will only appear for presenters that have their purpose set to ‘display’.

If you think about it, that is extremely valid, as editable fields will often be intentionally blank.

You weren’t clear on the purpose of your modified clipboard helper presenter, but the purpose set for that presenter is ‘modify’ and not ‘display’.


Given your requirement for ‘omit if blank’ I can only presume you have modified the presenter for a display only purpose and as such you need only alter the purpose on the basic tab of the presenter to enable the ‘omit of blank’ option in page builder.


Hope this helps.