Cameron 0 Posted July 14, 2015 Report Share Posted July 14, 2015 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! Quote Link to post Share on other sites
0 Solution Jan 51 Posted July 14, 2015 Solution Report Share Posted July 14, 2015 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. Quote Link to post Share on other sites
0 Cameron 0 Posted July 14, 2015 Author Report Share Posted July 14, 2015 Hi Jan, Yes, it helped! Thank you for your time! Quote Link to post Share on other sites
Question
Cameron 0
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
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.