Retrieving a field value from a custom control when there are multiple instances of the custom control

I have an xPage with multiple instances of the same custom control. How do I get the value of a field in a separate custom control using a button on my xPage.

Usually I would do something like:

ctlName = "radioGroupCMBUAction"; var changeType = getComponent (ctlName) .getValue ();

If there was only one instance of the control. How can I do this with multiple instances of the control?

0


source to share


2 answers


Without code, I'm not sure if .getValue () will work the way it did, it will have to pull out a field where the user control might have a repetition inside, etc.

Assuming it will work if each instance of customControl has a unique unique ID, it should work fine as each instance should have its own vriables inside it.

Other ideas, however, might be to pass in a string and use that string as a scoped variable name inside a custom control that can be pulled from anywhere. I did this before when I created a property in a custom control for a row and inside a custom control



viewScope[compositeData.customProperty] = value.

      

then outside of the context of the custom control, I know the string I passed into so that I can pull this value. Passing this means multiple instances won't write to each other.

Or you could write a field in your custom control for the document, either to retrieve it or as the ultimate solution to the persistence problem.

0


source


Not sure if this can help you ..? A while ago I wrote a review about "private" variables:



http://dontpanic82.blogspot.com/2010/03/xpages-tip-regarding-private-scoped.html

0


source







All Articles