Click to load a component
I'm trying to load a component programatically on the Idea Page.
The scenario is that I want to have the page load by default without the component "comment-editor". This is preferable to hiding/showing the editor, since I don't want any chance a comment can be added if the person is not authorized. To check if the person is authorized, on pageload, I will check the value of a profile field, in order to see if they have accepted our Terms and Conditions, which is a requirement to post a comment on an idea. If the user HAS already accepted our Terms and Conditions, they're authorized to post a comment, I would like to load the "comment-editor" component dynamically.
I found a reference for loading components dynamically here:
I've tried including these scripts in a page to see if it will load. The first one loads a Spinner, but nothing more. The second loads nothing:
<@liaAddScript>
LITHIUM.Components.renderInPlace("comment-editor");
</@liaAddScript>
<@liaAddScript>
LITHIUM.Components.render("comment-editor");
</@liaAddScript>
What do you think for loading this comment box dynamically? DougS ?
You could try creating a custom page in Studio that is exactly the same as the IdeaPage, except without the comment-editor component, and then use the http.response.replaceQuilt freemarker call inside of your page initialization script (see Using a FreeMarker Page Initialization Script for more information about that).