Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
FormAPI - setVisible() Problem
diamondneil
When I load my DCT I wish to hide the elements of a container to the user. I have done this by using the following code:
function setReplicantVisibility( dataCaptureItemPath, visibility ) {
var replicant = IWDatacapture.getItem( dataCaptureItemPath );
var replicantArray = replicant.getChildren();
for ( var i=0; i<replicantArray.length; i++ ) {
var replicantId = i+1;
var containerRef = dataCaptureItemPath + "[" + replicantId + "]";
IWDatacapture.getItem(containerRef).setVisible(visibility);
}
}
function hideItems() {
setReplicantVisibility('/index/content/copy',false);
}
hideItems();
I call the hideItems() function, and this hides my container that i wish to initially hide from the user. This works great.
Now when the user selects something from a dropdown I wish to make the container, and its items visible. I attempt to do this using the setReplicantVisibility, but this fails to make the items in the container visible. Here is the code:
function setRegularItems() {
setReplicantVisibility('/index/content/copy',true);
}
IWEventRegistry.addItemHandler( "/index/content/pgtype", "onItemChange", setRegularItems );
Any ideas?
Find more posts tagged with
Comments
cliffhanger
Where does hideItems() get called? Can you post your entire JS?
diamondneil
<script>
<![CDATA[
// Hide all sub section items
hideItems();
function hideItems() {
setReplicantVisibility('/index/content/copy',false);
}
function setReplicantVisibility( dataCaptureItemPath, visibility ) {
var replicant = IWDatacapture.getItem( dataCaptureItemPath );
var replicantArray = replicant.getChildren();
for ( var i=0; i<replicantArray.length; i++ ) {
var replicantId = i+1;
var containerRef = dataCaptureItemPath + "[" + replicantId + "]";
IWDatacapture.getItem(containerRef).setVisible(visibility);
}
}
function setItems() {
setReplicantVisibility('/index/content/copy',true);
}
IWEventRegistry.addItemHandler( "/index/content/pgtype", "onItemChange", setItems );
]]>
</script>
diamondneil
hideItems() must be getting called whenever the onItemChange event occurs.
diamondneil
One other question. I can make the items within a container invisible, but I see still the outline of the container. Is there anyway to remove this?
Adam Stoller
You should probably create an init() function - put hideitems() within there along with your item event triggers - that way hideitems should only get called once when init is called.
I don't believe you can hide the actual container just the items within it (there were several posts about this not too long ago)
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
diamondneil
I don't really see how this will help?
Adam Stoller
I don't really see how it could hurt - but there's a small chance it might help - if you don't want to, that's fine with me.
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
JonathonG
I know this thread is a bit old, but here's a suggestion. Add a call to IWDatacapture.Refresh() to the end of your setReplicantVisibility function.
Jonathon
Interwoven Developer
Allstate, Inc.
Adam Stoller
If you're using 6.5 - Refresh is no longer needed - if you're using 6.1 it might be (don't remember when they did away with it)
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
cliffhanger
you don't need it in 6.1 either
JonathonG
Ok, I stand (err, sit) corrected.
Jonathon
Interwoven Developer
Allstate, Inc.
cliffhanger
:-)