I have an xPage that is needing to have multiple custom controls in it. Single Form, to single Xpage with a Generic Data section (custom control) and then based on the value of the first field in the Generic Section will be one of 5 possible custom controls coming in. I have been trying to find a post here about something like this and it seems that computed custom controls on an Xpage is possible but I did not see an example (prolli missed the post).
I was wondering if I could do something like this or if there is a better way. (on custom control or xPage)
xp:this.data
<xp:dominoDocument var=“doc1”
formName="Request" action="openDocument">
</xp:dominoDocument>
</xp:this.data>
var check1 = doc1.getElementByID(‘type’).value;
xp:panel
xc:generic</xc:generic>
</xp:panel>
<span id=type1 display=>
xp:panel
xc:req1</xc:req1>
</xp:panel>
<span id=type2 display=>
xp:panel
xc:req2</xc:req2>
</xp:panel>
Anyway…where the display portion of the span tag would be based on the value of the check1…if it was type1 that control shows the rest are hidden etc.
I know I would have to clean up the way it is written above, but was looking to see if this was even possible or if there is another/better way to do this. If there is another post out there that I missed if you could point me in the right direction that would be appreciated.
Thanks in advance,
Steven
Subject: Re: Multiple Custom Control
You can set them to be visible or not. But it sounds like the better option would be to consider either the loaded or rendered properties. Look at this post, part of the excellent XPages tutorial by Declan, for info.
Then you can use scoped variables to compute whether they are loaded or not. See this article on the Domino wiki about scoped variables - it’s worth getting to understand them as you will soon be using them everywhere.
http://www-10.lotus.com/ldd/ddwiki.nsf/dx/xpages-scoped-variables.htm
For examples of using the loaded property, look at the new Discussion database template that comes with 8.5, e.g. the allDocuments XPage, or TaskJam, a free XPages database from Elguji Software. There’s also an XPages wiki template on OpenNTF. All are excellent resources for helping you make the most of XPages.
Regards
Paul
Subject: Using Scoped Variables
Paul,
Thanks for the thoughts and ideas. I will try them out.
Steven
Subject: Do you have access to eview.com? I had an article published on this subject
here’s a link to an article that describes how to compute a custom control at load time: http://www.eview.com/eview/VOLR6.nsf/CurrentIssue/1D889B952AE09321852575DA00466C40?OpenDocument
If you don’t have access to eview.com, look at the Editable area control help.
-John