Jump to content
  • 0

Is It Possible To Hide The Part Of A Text In An Html Block, If A Parameter Is Empty?


Go to solution Solved by Jan,

Question

Hi everyone!

 

I have an HTML block, where I want to display parameters like follows:

 

Author: [@field:author], Coauthor:[@field:coauthor]

 

But the [@field:coauthor] parameter is empty often.

 

Is it possible to display the ", Coauthor:[@field:coauthor]" part only if a coauthor is exist?

 

Thank you for your time!

Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0
  • Solution

Hello Cameron,

 

If I understand correctly, you can use a JavaScript code.

Please select your "HTML Block", click the "Source" button, delete the current text and enter the following code:

Author: [@field:author]
<script language="javascript">
var coauthor='[@field:coauthor]';
if (coauthor.length>0)
{
coauthor = ", Coauthor: "+coauthor;
document.write(coauthor);
}
</script>

Also I would recommend you to disable AJAX on the DataPage.

You can open the "Results Page Options" step and uncheck the "Enable AJAX" checkbox.

 

I hope, it helps.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...