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)
setReadOnly for replicants
infoForDj
Hi,
I have radio buttons say 1 and 2. I also have a container which acts as a replicant having min = 1 and max = 20. The container has 6 items in it. If radio button 1 is selected then this replicant needs to be disabled. Now, I am checking how many children of this replicant are active, running a for loop and setting their read only property to true.
But the issue is that if I do this then the program becomes so slow that it makes my computer unresponsive. I have to abort the script if the DCT has to show up.
My code is :
var subSection = IWDatacapture.getItem("/promotionRawDetail/subSectionCopy").getChildren();
var length = subSection.length * 6;
for(j=0; j<length; j+6)
{
for(i=0; i<subSection.length; i++)
{
disableChange = eval(subSection
).getName()+"/subSectionTitle";
disableChange[j+1] = eval(subSection
).getName()+"/details";
disableChange[j+2] = eval(subSection
).getName()+"/subSectionImage[1]/imageFile";
disableChange[j+3] = eval(subSection
).getName()+"/subSectionImage[1]/imageLink";
disableChange[j+4] = eval(subSection
).getName()+"/subSectionImage[1]/altTag";
disableChange[j+5] = eval(subSection
).getName()+"/subSectionImage[1]/imageLocation";
}
}
onCheckEnableDisable();
Where onCheckEnableDisable will run through disableChange array and set each element's readOnly property to true.
Please help me to arrive at a better solution to set read only to true for replicants.
Thanks,
Dhruv
Find more posts tagged with
Comments
Adam Stoller
Well - first of all you ran into the funky formatting problem on DevNet posts where
gets treated as the beginning of an italicized section and also fails to show up in the post - I suggest you put spaces around the '
i
' so that it looks like
[ i ]
or change the formatting of the post to
using HTML
or
without Markup/HTML
to avoid this problem.
Second - you failed to provide information about what version of TeamSite Templating / FormsPublisher you are using. It makes a difference because later versions of the product include additional functionality - especially in the case of TS6.5 which provides better interfaces for dealing with replicants (check out the recent webcast). Although now that I'm looking at your post again, it sounds like you're using 6.x because you say you have a container with min/max values - so then the question is are you using 6.0, 6.1, 6.1SP1, or 6.5?
In 5.x I believe one was able to disable entire containers (but not replicants) - I'm not sure how it works in 6.x, but have you tried just disabling the container itself rather than recursing through it to disable each element within the replicated container? Assuming you want to disable the entire container and not just certain fields within each instance of it - this might be far more efficient.
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
infoForDj
Hi,
I am currently working on 6.0 but will soon migrate to 6.5. Containers and replicants cannot be disabled as whole in 6.0 so have to disable each item individually. Also the code is :
var subSection = IWDatacapture.getItem("/promotionRawDetail/subSectionCopy").getChildren();
var length = subSection.length * 6;
for(j=0; j<length; j+6)
{
for(i=0; i<subSection.length; i++)
{
disableChange[ j ] = eval(subSection[ i ]).getName()+"/subSectionTitle";
disableChange[ j+1 ] = eval(subSection[ i ]).getName()+"/details";
disableChange[ j+2 ] = eval(subSection[ i ]).getName()+"/subSectionImage[ 1 ]/imageFile";
disableChange[ j+3 ] = eval(subSection[ i ]).getName()+"/subSectionImage[ 1 ]/imageLink";
disableChange[ j+4 ] = eval(subSection[ i ]).getName()+"/subSectionImage[ 1 ]/altTag";
disableChange[ j+5 ] = eval(subSection[ i ]).getName()+"/subSectionImage[ 1 ]/imageLocation";
}
}
Please provide a solution to the problem stated earlier.
Thanks,
Dhruv
Adam Stoller
I'm still inthe early stages of moving my customer to 6.5 - don't even have a server set up sufficiently to easily hack on this right now - sorry.
However, if you're planning to move to 6.5 and you haven't yet looked at the recent 6.5/FormAPI webcast - I'd encourage you to do so - as it does talk about referencing replicant instances in a more efficient manner than was previously possible.
Hmm - looking at the code you posted - I'm confused as to how/why you are using 'j' - wouldn't it be simpler to just get each item and disable it directly rather than running a bunch of eval's and storing the information in an array for later processing? Wouldn't it be faster to do something like (off the top-of-my-head, likely-to-contain-errors):
var subSection = IWDatacapture.getItem("/promotionRawDetail/subSection.Copy").getChildren();
for(i = 0; i < subSection.length; i++){
IWDatacapture.getItem("/promotionRawDetail/subSection.Copy
/subSectionTitle").setVisible("false");
IWDatacapture.getItem("/promotionRawDetail/subSection.Copy
/deails").setVisible("false");
...
}
IWDatacapture.redraw();
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
Migrateduser
here's a link to the webcast (and sample code) that Adam referred to in his post:
http://devnet.interwoven.com/site.fcgi/webcasts/docs/webcast-recordings.html#webcast04-23
hth,
lissa