ShowTable of Contents
Use the result of a server side script in the client
For example, use the result of a @DbName in your client script:
dbname='#{javascript:@DbName()}';
Get the runtime id of a control
In the XPage you set a name / id for a control, for example "panelSidebar". But at runtime, in the browser, that id is prefixed with some other stuff, so you cannot use "dojo.byId('panelSidebar')" to get the element.
You need to get the runtime id with the following piece of client javascript:
var id = "#{id:nameOfControl}";
For example:
var id = "#{id:panelSidebar}";
dojo.byId(id).innerHTML = "I just dynamically modified the content of a panel.";
Note that this method only works where you can write client javascript in some XPage control.
It does NOT work when you embed JavaScript directly in the source code of the XPage.
Trigger partial update for a certain control
You can use the XSP object to trigger a partial update of a specific control, using the runtime id of that control:
XSP.partialRefreshPost(id);
Other useful XSP functions
XSP.startsWith(string, substring)
XSP.endsWith(string, substring)
returns true if a string starts/ends with a certain substring.