Forum Discussion

iftomkins's avatar
10 years ago

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: 

http://community.lithium.com/t5/Developers-Discussion/Click-to-load-a-component/m-p/168251/highlight/true#M6741

 

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 ?

 

  • iftomkins - Did you check in the firebug if you're getting any errors in console? I am getting 404's using both renderInPlace and render.

    • iftomkins's avatar
      iftomkins
      Maven

      VarunGrazitti - Yes, I'm getting those same 404 errors in the console. I've attached a screenshot. 

       

      Do you have any hunches about what the issue might be? Perhaps it's a deprecated function, or one that needs to be turned on by Lithium support, like Page Initialization? DougS ?Screenshot 2015-04-06 12.13.38.png

       

       

      • DougS's avatar
        DougS
        Khoros Oracle

        It doesn't look like we support rendering the "comment-editor" component (or "page level" components like it) via these javascript functions.  If this is something you would like to enforce community-wide, you can adjust this setting in the admin:

         

        Screen Shot 2015-04-06 at 1.56.15 PM.png

        If you check the "Users must confirm email before posting and sending private messages" checkbox and save, users will see this when they go to the idea page:

        Screen Shot 2015-04-06 at 1.57.12 PM.png

         

        That checkbox can only be set at the community level -- it makes it so users must verify their email before doing any kind of posting or private messaging anywhere in the community.  We don't currently have a narrorer scope than that.