Triggering client script from server side on XPages saves developers in many scenarios.
I missed them so badly until I came to know about the "xp:onComplete" tag.
Associate this property to the event handler of any of the controls with partial refresh enabled and voila you are ready to go.
The following is a simple example on getting the property to work in xpages.
Ensure that the control does not have full update enabled cos, this method would work only when partial refresh is enabled