How to update a tokens value to nothing? (not even a single space) | Community
Skip to main content
New Participant
October 16, 2020
Solved

How to update a tokens value to nothing? (not even a single space)

  • October 16, 2020
  • 1 reply
  • 2670 views

Hello Marketo Community!

 

I have created a list of client info, for a (guided) landing page template: 

 

<ul>

   <li>{{my.CON Client Name}}</li>

   <li>{{my.CON Client Address}}</li>

   <li>{{my.CON Client Phone Number}}</li>

</ul>


Now, let's say that the client does not want to show their phone number.

 

What I would like to be able to do, is to apply a display-none rule, to any empty list items, as such:

 

li:empty {

   display: none;

}


Here comes the problem. 

 

When I remove the value from the {{my.CON Client Phone Number}}, I get an error saying that "This field is required". A workaround would be to just input an empty space. But an empty space, would mean that the list-item is not empty. So, my display-none rule for empty list items would not work.

 

So, how to solve this particular problem? 

 

To my knowledge, there is no way of creating a token without a value. But is there some marketo-keyword for NULL or something similar, so that we get an empty list item in the output?

 

Thanks for the help in advance! 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by ernie-1

Hello again!

 

I found the solution, and wanted to add it here in case someone else stumbled on the same problem.

 

Solution:

You can input a html comment tag as the tokens value: <!-- -->

This makes sure that you can update/create the token with a value, that is essentially empty (at least it will not render on the page).

I tried all major browsers (Safari/Chrome/Firefox) and it seems to work fine.

1 reply

ernie-1AuthorAccepted solution
New Participant
October 16, 2020

Hello again!

 

I found the solution, and wanted to add it here in case someone else stumbled on the same problem.

 

Solution:

You can input a html comment tag as the tokens value: <!-- -->

This makes sure that you can update/create the token with a value, that is essentially empty (at least it will not render on the page).

I tried all major browsers (Safari/Chrome/Firefox) and it seems to work fine.

SanfordWhiteman
New Participant
October 16, 2020

Nicely done, Ernie.

 

My Firefox DE (81.0b5 and 82.0b9 after I let it update) doesn't show the bug you describe. The CSS spec is clear that comments are not considered:

 

only element nodes and content nodes (such as DOM [DOM-LEVEL-3-CORE] text nodes, CDATA nodes, and entity references) whose data has a non-zero length must be considered as affecting emptiness; comments, processing instructions, and other nodes must not affect whether an element is considered empty or not.

ernie-1Author
New Participant
October 19, 2020

Thanks SanfordWhiteman!

 

I just checked Firefox Developer Edition once more, and it does work as expected.

 

So I just updated my previous comment for future reference.

 

Have a good one!