xpages

can i check if an element is available before I use XSP.partialRefreshGet to update it?


since the ID of a control in xpages is dynamic I cannot a normal selector to check if the element exists on the xpage e.g.

if (document.getElementById("myElementId")) {
   XSP.partialRefreshGet("#{id:myElementId}", {});
}

what alternative do I have? a "partial" ID selector?


Solution

  • have you tried:

    if (document.getElementById("#{id:myElementId}")) {
       XSP.partialRefreshGet("#{id:myElementId}", {});
    }