Please excuse this if it seems like a very basic question - I am trying my best to “catch up” to all the XPages professionals out there!
I have a custom control that contains an unordered list (UL).
That UL has a default class associated with it in the HTML (source) code.
I would like to change the class associated with that UL when the control is loaded, based on a field value retrieved from the underlying document.
Typically, I have been able to perform the dynamic association of classes with other elements in the control (e.g. tables), but those are all known to XPages.
In those cases, I can calculate the className value with script by clicking on the “diamond” next to the parameter.
Unfortunately, a “UL” element is not natively known to XPages, and that diamond is not available.
I believe I need to use client-side script to retrieve the document value, and then get a handle to the UL element and change the class.
I think I can handle that, but where do I place the code? Historically, I would embed some calculated text in a script block on a form/page, and call that when the page was loaded (onLoad).
I’m just not as familar as I should be with the new environment, and need a push in the right direction in this case.
Is anyone able to provide me with some assistance?
Another option is to use a Computed Field control to pass the HTML onto your XPage. A Computed Field control can have the Content Type set to HTML (or parameter escape=“false” in the source panel), kind of like pass-thru HTML on a Notes form.
So you compute the output of your Computed Field control using server-side javascript to get the underlying document and the class and write that along with your ul tag, so e.g.
var class=document1.getItemValueString(“ClassName”)
return “
”
You may need another Computed Field Control to close your ul afterwards, I’m not sure if the source panel will accept it written on the XPage.