Misha Ovsichtcher
Misha Ovsichtcher

Reputation: 1

How to find programmatically (SSJS) what item of the underlying doc the UI input control on Xpage is bound to?

The task is that I need to update the field of the underlying doc only given the id of the edit box or the combo box on the Xpage. All that has to happen before the page is actually saved. Cannot find any methods in UIComponent and subclasses that allow to find out the name of the actual doc item the current XSP input control is bound to. Plz help.

Upvotes: 0

Views: 727

Answers (1)

Paul Stephen Withers
Paul Stephen Withers

Reputation: 15739

The following will get the Expression Language binding for a component with the id inputText1:

var inputText1:com.ibm.xsp.component.xp.XspInputText = getComponent("inputText1");
var valBinding:com.sun.faces.el.ValueBindingImpl = inputText1.getValueBinding("value");
return valBinding.getExpressionString();

This will return e.g. "#{document1.myField}". Using basic string parsing, you should be able to get what you want.

Like Oliver, I'd be interested to hear the use case. It's not something I've had the need to use.

As a bonus, try looking in the Local folder in Package Explorer at an XPage / Custom Control. You'll see all the getters / setters for components on your XPage, which will give you hints for what properties and methods are available. F3 and F4 are very useful for seeing all methods/properties and class hierarchy.

Upvotes: 2

Related Questions