Xpages - Custom control getting a custom property from another custom control The Next CEO of Stack OverflowGetting a field value from a custom control when there are multiple instances of the custom controlPass javascript code to Custom ControlXPages - Repeat Control - Get item ValueXPage Custom Controls: calling an action defined in a custom controllReusable Custom Control with ComboBox: Add <selectItems> thru Property DefinitionXpages repeat control get id of inputTextXPages repeat control and buttondefining an object property in a compositeData on a custom controlXpages: Can a custom control have a variable number of facets?Xpages - SSJS code via custom control property
My boss doesn't want me to have a side project
How exploitable/balanced is this homebrew spell: Spell Permanency?
How to implement Comparable so it is consistent with identity-equality
How did scripture get the name bible?
pgfplots: How to draw a tangent graph below two others?
Why was Sir Cadogan fired?
Free fall ellipse or parabola?
Is the 21st century's idea of "freedom of speech" based on precedent?
Is it a bad idea to plug the other end of ESD strap to wall ground?
How should I connect my cat5 cable to connectors having an orange-green line?
Is a distribution that is normal, but highly skewed, considered Gaussian?
What is the difference between 'contrib' and 'non-free' packages repositories?
Read/write a pipe-delimited file line by line with some simple text manipulation
Prodigo = pro + ago?
Could you use a laser beam as a modulated carrier wave for radio signal?
Gödel's incompleteness theorems - what are the religious implications?
Gauss' Posthumous Publications?
How can a day be of 24 hours?
Does the Idaho Potato Commission associate potato skins with healthy eating?
Is it possible to create a QR code using text?
Could a dragon use its wings to swim?
Is it possible to make a 9x9 table fit within the default margins?
How can I separate the number from the unit in argument?
How to pronounce fünf in 45
Xpages - Custom control getting a custom property from another custom control
The Next CEO of Stack OverflowGetting a field value from a custom control when there are multiple instances of the custom controlPass javascript code to Custom ControlXPages - Repeat Control - Get item ValueXPage Custom Controls: calling an action defined in a custom controllReusable Custom Control with ComboBox: Add <selectItems> thru Property DefinitionXpages repeat control get id of inputTextXPages repeat control and buttondefining an object property in a compositeData on a custom controlXpages: Can a custom control have a variable number of facets?Xpages - SSJS code via custom control property
I've searched google and stack but can't seem to find a definitive answer. What I would like to do, is something like this:
Say I have custom control A, within which, is a radio button, when I click it, I want it to grab a custom property that is set on custom control B, lets say compositeData.Name as an example. Can I do this?
If I give custom control B an ID, lets say ccB, can the radio button in custom control A do something like, getComponent("ccB").getValue().compositeData.Name so I can get the value of the property I passed into custom control B using the custom property 'Name'?
If its a straight no, at least I know to stop playing around with the idea! Thanks
xpages
|
show 1 more comment
I've searched google and stack but can't seem to find a definitive answer. What I would like to do, is something like this:
Say I have custom control A, within which, is a radio button, when I click it, I want it to grab a custom property that is set on custom control B, lets say compositeData.Name as an example. Can I do this?
If I give custom control B an ID, lets say ccB, can the radio button in custom control A do something like, getComponent("ccB").getValue().compositeData.Name so I can get the value of the property I passed into custom control B using the custom property 'Name'?
If its a straight no, at least I know to stop playing around with the idea! Thanks
xpages
4
Your question is based on whether it could be done or not. But what you should be more concerned about is the why. What your are trying to accomplish is an anti-pattern. You’re trying to overextended the component responsibility to control and read data, data that it wasn’t given to it. A custom control on the page should know nothing about the existence of another custom control in the view tree. Flow should always be top-down and in case something needs to trigger a particular behavior to bubble up and be caught by a higher controller in the hierarchy. What are you trying to do exactly?
– shillem
Mar 21 at 21:23
Extract the property to a bean. And use this bean in the compositeData properties. Put the bean in the viewscope or use some viewscope variables for that.
– umeli
Mar 22 at 9:06
@shillem My top level CC drives lower level stuff, showing / hiding of certain questions for example. If question 1, drives question 2 and 3, and the user answers question 2 and 3, but then changes their mind on question 1 meaning items in question 2 or 3 are now not needed, I want to wipe some of their values and do some other bits. I've created a custom property on Q1 which contains an array of questions to wipe if certain conditions are met which works fine, however some field names for example are computed dynamically based on the custom property values, so I want to get a handle on them
– Chris Richards
Mar 22 at 10:21
By custom property in Q1 you mean that each question is a custom control embedded by your top level CC? Does the top level have any bearing as to whether these question CC are present on the page? Are these questions hardcoded in the xsp or generated dynamically (say by an xp:repeat loop)?
– shillem
Mar 22 at 12:32
@shillem to keep it simple, lets say I have 1 custom control (the question and fields) and around 50 of them on the page. Each has the same custom properties, i.e question text and review team but obviously the custom property has a different value passed into each cc. But the custom control containing question 3 could be shown or hidden based on the answer selected from the custom control that contains question 1.
– Chris Richards
Mar 22 at 14:18
|
show 1 more comment
I've searched google and stack but can't seem to find a definitive answer. What I would like to do, is something like this:
Say I have custom control A, within which, is a radio button, when I click it, I want it to grab a custom property that is set on custom control B, lets say compositeData.Name as an example. Can I do this?
If I give custom control B an ID, lets say ccB, can the radio button in custom control A do something like, getComponent("ccB").getValue().compositeData.Name so I can get the value of the property I passed into custom control B using the custom property 'Name'?
If its a straight no, at least I know to stop playing around with the idea! Thanks
xpages
I've searched google and stack but can't seem to find a definitive answer. What I would like to do, is something like this:
Say I have custom control A, within which, is a radio button, when I click it, I want it to grab a custom property that is set on custom control B, lets say compositeData.Name as an example. Can I do this?
If I give custom control B an ID, lets say ccB, can the radio button in custom control A do something like, getComponent("ccB").getValue().compositeData.Name so I can get the value of the property I passed into custom control B using the custom property 'Name'?
If its a straight no, at least I know to stop playing around with the idea! Thanks
xpages
xpages
asked Mar 21 at 20:06
Chris RichardsChris Richards
623412
623412
4
Your question is based on whether it could be done or not. But what you should be more concerned about is the why. What your are trying to accomplish is an anti-pattern. You’re trying to overextended the component responsibility to control and read data, data that it wasn’t given to it. A custom control on the page should know nothing about the existence of another custom control in the view tree. Flow should always be top-down and in case something needs to trigger a particular behavior to bubble up and be caught by a higher controller in the hierarchy. What are you trying to do exactly?
– shillem
Mar 21 at 21:23
Extract the property to a bean. And use this bean in the compositeData properties. Put the bean in the viewscope or use some viewscope variables for that.
– umeli
Mar 22 at 9:06
@shillem My top level CC drives lower level stuff, showing / hiding of certain questions for example. If question 1, drives question 2 and 3, and the user answers question 2 and 3, but then changes their mind on question 1 meaning items in question 2 or 3 are now not needed, I want to wipe some of their values and do some other bits. I've created a custom property on Q1 which contains an array of questions to wipe if certain conditions are met which works fine, however some field names for example are computed dynamically based on the custom property values, so I want to get a handle on them
– Chris Richards
Mar 22 at 10:21
By custom property in Q1 you mean that each question is a custom control embedded by your top level CC? Does the top level have any bearing as to whether these question CC are present on the page? Are these questions hardcoded in the xsp or generated dynamically (say by an xp:repeat loop)?
– shillem
Mar 22 at 12:32
@shillem to keep it simple, lets say I have 1 custom control (the question and fields) and around 50 of them on the page. Each has the same custom properties, i.e question text and review team but obviously the custom property has a different value passed into each cc. But the custom control containing question 3 could be shown or hidden based on the answer selected from the custom control that contains question 1.
– Chris Richards
Mar 22 at 14:18
|
show 1 more comment
4
Your question is based on whether it could be done or not. But what you should be more concerned about is the why. What your are trying to accomplish is an anti-pattern. You’re trying to overextended the component responsibility to control and read data, data that it wasn’t given to it. A custom control on the page should know nothing about the existence of another custom control in the view tree. Flow should always be top-down and in case something needs to trigger a particular behavior to bubble up and be caught by a higher controller in the hierarchy. What are you trying to do exactly?
– shillem
Mar 21 at 21:23
Extract the property to a bean. And use this bean in the compositeData properties. Put the bean in the viewscope or use some viewscope variables for that.
– umeli
Mar 22 at 9:06
@shillem My top level CC drives lower level stuff, showing / hiding of certain questions for example. If question 1, drives question 2 and 3, and the user answers question 2 and 3, but then changes their mind on question 1 meaning items in question 2 or 3 are now not needed, I want to wipe some of their values and do some other bits. I've created a custom property on Q1 which contains an array of questions to wipe if certain conditions are met which works fine, however some field names for example are computed dynamically based on the custom property values, so I want to get a handle on them
– Chris Richards
Mar 22 at 10:21
By custom property in Q1 you mean that each question is a custom control embedded by your top level CC? Does the top level have any bearing as to whether these question CC are present on the page? Are these questions hardcoded in the xsp or generated dynamically (say by an xp:repeat loop)?
– shillem
Mar 22 at 12:32
@shillem to keep it simple, lets say I have 1 custom control (the question and fields) and around 50 of them on the page. Each has the same custom properties, i.e question text and review team but obviously the custom property has a different value passed into each cc. But the custom control containing question 3 could be shown or hidden based on the answer selected from the custom control that contains question 1.
– Chris Richards
Mar 22 at 14:18
4
4
Your question is based on whether it could be done or not. But what you should be more concerned about is the why. What your are trying to accomplish is an anti-pattern. You’re trying to overextended the component responsibility to control and read data, data that it wasn’t given to it. A custom control on the page should know nothing about the existence of another custom control in the view tree. Flow should always be top-down and in case something needs to trigger a particular behavior to bubble up and be caught by a higher controller in the hierarchy. What are you trying to do exactly?
– shillem
Mar 21 at 21:23
Your question is based on whether it could be done or not. But what you should be more concerned about is the why. What your are trying to accomplish is an anti-pattern. You’re trying to overextended the component responsibility to control and read data, data that it wasn’t given to it. A custom control on the page should know nothing about the existence of another custom control in the view tree. Flow should always be top-down and in case something needs to trigger a particular behavior to bubble up and be caught by a higher controller in the hierarchy. What are you trying to do exactly?
– shillem
Mar 21 at 21:23
Extract the property to a bean. And use this bean in the compositeData properties. Put the bean in the viewscope or use some viewscope variables for that.
– umeli
Mar 22 at 9:06
Extract the property to a bean. And use this bean in the compositeData properties. Put the bean in the viewscope or use some viewscope variables for that.
– umeli
Mar 22 at 9:06
@shillem My top level CC drives lower level stuff, showing / hiding of certain questions for example. If question 1, drives question 2 and 3, and the user answers question 2 and 3, but then changes their mind on question 1 meaning items in question 2 or 3 are now not needed, I want to wipe some of their values and do some other bits. I've created a custom property on Q1 which contains an array of questions to wipe if certain conditions are met which works fine, however some field names for example are computed dynamically based on the custom property values, so I want to get a handle on them
– Chris Richards
Mar 22 at 10:21
@shillem My top level CC drives lower level stuff, showing / hiding of certain questions for example. If question 1, drives question 2 and 3, and the user answers question 2 and 3, but then changes their mind on question 1 meaning items in question 2 or 3 are now not needed, I want to wipe some of their values and do some other bits. I've created a custom property on Q1 which contains an array of questions to wipe if certain conditions are met which works fine, however some field names for example are computed dynamically based on the custom property values, so I want to get a handle on them
– Chris Richards
Mar 22 at 10:21
By custom property in Q1 you mean that each question is a custom control embedded by your top level CC? Does the top level have any bearing as to whether these question CC are present on the page? Are these questions hardcoded in the xsp or generated dynamically (say by an xp:repeat loop)?
– shillem
Mar 22 at 12:32
By custom property in Q1 you mean that each question is a custom control embedded by your top level CC? Does the top level have any bearing as to whether these question CC are present on the page? Are these questions hardcoded in the xsp or generated dynamically (say by an xp:repeat loop)?
– shillem
Mar 22 at 12:32
@shillem to keep it simple, lets say I have 1 custom control (the question and fields) and around 50 of them on the page. Each has the same custom properties, i.e question text and review team but obviously the custom property has a different value passed into each cc. But the custom control containing question 3 could be shown or hidden based on the answer selected from the custom control that contains question 1.
– Chris Richards
Mar 22 at 14:18
@shillem to keep it simple, lets say I have 1 custom control (the question and fields) and around 50 of them on the page. Each has the same custom properties, i.e question text and review team but obviously the custom property has a different value passed into each cc. But the custom control containing question 3 could be shown or hidden based on the answer selected from the custom control that contains question 1.
– Chris Richards
Mar 22 at 14:18
|
show 1 more comment
1 Answer
1
active
oldest
votes
Reaching from one control into the inside of another control would break component isolation. You might want to take a different approach:
Option a - client side:
Your control emits a JavaScript event that bubbles up until it reaches a parent element that contains the control you want to change (presumably the parent Dom element). There you set the property of that element.
Option b - server side:
As Urs suggested: bind both to a bean and handle the updates inside the bean
Thanks Stephan (and all who commented) I've accepted your answer, and will look to implement this in version 2 of my application
– Chris Richards
Mar 26 at 14:32
add a comment |
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55288502%2fxpages-custom-control-getting-a-custom-property-from-another-custom-control%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Reaching from one control into the inside of another control would break component isolation. You might want to take a different approach:
Option a - client side:
Your control emits a JavaScript event that bubbles up until it reaches a parent element that contains the control you want to change (presumably the parent Dom element). There you set the property of that element.
Option b - server side:
As Urs suggested: bind both to a bean and handle the updates inside the bean
Thanks Stephan (and all who commented) I've accepted your answer, and will look to implement this in version 2 of my application
– Chris Richards
Mar 26 at 14:32
add a comment |
Reaching from one control into the inside of another control would break component isolation. You might want to take a different approach:
Option a - client side:
Your control emits a JavaScript event that bubbles up until it reaches a parent element that contains the control you want to change (presumably the parent Dom element). There you set the property of that element.
Option b - server side:
As Urs suggested: bind both to a bean and handle the updates inside the bean
Thanks Stephan (and all who commented) I've accepted your answer, and will look to implement this in version 2 of my application
– Chris Richards
Mar 26 at 14:32
add a comment |
Reaching from one control into the inside of another control would break component isolation. You might want to take a different approach:
Option a - client side:
Your control emits a JavaScript event that bubbles up until it reaches a parent element that contains the control you want to change (presumably the parent Dom element). There you set the property of that element.
Option b - server side:
As Urs suggested: bind both to a bean and handle the updates inside the bean
Reaching from one control into the inside of another control would break component isolation. You might want to take a different approach:
Option a - client side:
Your control emits a JavaScript event that bubbles up until it reaches a parent element that contains the control you want to change (presumably the parent Dom element). There you set the property of that element.
Option b - server side:
As Urs suggested: bind both to a bean and handle the updates inside the bean
answered Mar 23 at 7:07
stwisselstwissel
17.1k33478
17.1k33478
Thanks Stephan (and all who commented) I've accepted your answer, and will look to implement this in version 2 of my application
– Chris Richards
Mar 26 at 14:32
add a comment |
Thanks Stephan (and all who commented) I've accepted your answer, and will look to implement this in version 2 of my application
– Chris Richards
Mar 26 at 14:32
Thanks Stephan (and all who commented) I've accepted your answer, and will look to implement this in version 2 of my application
– Chris Richards
Mar 26 at 14:32
Thanks Stephan (and all who commented) I've accepted your answer, and will look to implement this in version 2 of my application
– Chris Richards
Mar 26 at 14:32
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55288502%2fxpages-custom-control-getting-a-custom-property-from-another-custom-control%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
4
Your question is based on whether it could be done or not. But what you should be more concerned about is the why. What your are trying to accomplish is an anti-pattern. You’re trying to overextended the component responsibility to control and read data, data that it wasn’t given to it. A custom control on the page should know nothing about the existence of another custom control in the view tree. Flow should always be top-down and in case something needs to trigger a particular behavior to bubble up and be caught by a higher controller in the hierarchy. What are you trying to do exactly?
– shillem
Mar 21 at 21:23
Extract the property to a bean. And use this bean in the compositeData properties. Put the bean in the viewscope or use some viewscope variables for that.
– umeli
Mar 22 at 9:06
@shillem My top level CC drives lower level stuff, showing / hiding of certain questions for example. If question 1, drives question 2 and 3, and the user answers question 2 and 3, but then changes their mind on question 1 meaning items in question 2 or 3 are now not needed, I want to wipe some of their values and do some other bits. I've created a custom property on Q1 which contains an array of questions to wipe if certain conditions are met which works fine, however some field names for example are computed dynamically based on the custom property values, so I want to get a handle on them
– Chris Richards
Mar 22 at 10:21
By custom property in Q1 you mean that each question is a custom control embedded by your top level CC? Does the top level have any bearing as to whether these question CC are present on the page? Are these questions hardcoded in the xsp or generated dynamically (say by an xp:repeat loop)?
– shillem
Mar 22 at 12:32
@shillem to keep it simple, lets say I have 1 custom control (the question and fields) and around 50 of them on the page. Each has the same custom properties, i.e question text and review team but obviously the custom property has a different value passed into each cc. But the custom control containing question 3 could be shown or hidden based on the answer selected from the custom control that contains question 1.
– Chris Richards
Mar 22 at 14:18