Search code examples
htmlxpagesxpages-ssjsssjs

How do I remove HTML elements beforePageLoad on an XPage


I have an XPage which can be used for editing or just reading based on an user's role. Now I need to implement this feature. The solution is really simple - just remove adding, editing, and other HTML elements. The problem is that I only can execute SSJS code, but not CSJS on a page loading. When I tried to do it like this document. in SSJS it gives me a predictable exception - document is not recongized. How do I execute it on page load anyway?


Solution

  • Don't try to remove HTML elements from rendered page.

    Use the property "rendered" instead to determine which controls should be rendered depending on user rights. ("Rendered" means created and sent to browser.)

    You can set this property here

    enter image description here

    or here

    enter image description here

    Insert SSJS code there which should return true (= visible) or false (= invisible).