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)
SetFocus - 6.1
meha
HI ,
Im working on Teamsite 6.1. Im trying to setFocus for an item. But it throws a javascript error - datacapture is undefined.
Is this a bug or can it be solved ???
Anyone pls suggest ...
Thanks a ton,
Meha
Find more posts tagged with
Comments
Migrateduser
Why don't you attach your code and perhaps you'll get a detailed response.
Current Environments:
(1,2) TS 6.5 on W2K3
(3) Vignette V7 Portal on Solaris 9
meha
Hi Dave,
This is the piece of code that performs it :
----------------------------------------------------------------------------------------------------------------
allRootItems = IWDatacapture.getRootItems();
for (i=0;i<allRootItems.length ;i++ ){
if (allRootItems
.getName() == "/Automation")
{
rootItem = allRootItems
.getChildren();
for (i=0;i<rootItem.length ;i++ )
{
if (rootItem
.getName() == "/Automation/Generation_Location")
{
var nextItem = rootItem[i+1].getName();
var setFocusFor = IWDatacapture.getItem(nextItem);
alert(setFocusFor.getName());
setFocusFor.setFocus();
}
}
}
----------------------------------------------------------------------------------------------------------------
When i try alerting the name it alerts, i guess that means the item is getting referred... but on setFocus it doesnt...
Thanks,
Meha
Migrateduser
Just a comment, but your loop structure seems like a horribly inefficient way to get to the variable you need, but I'm saying that out of context of the rest of your code, so take that for whatever it's worth.
setFocus does not return anything if the item is readonly, but you're not even getting that far. Are you certain that it's bugging out at the setFocus() call? If you were to put another alert just after the call, can you verify that the 2nd alert does not get invoked? Also, please post your datacapture.cfg.
Dave
Current Environments:
(1,2) TS 6.5 on W2K3
(3) Vignette V7 Portal on Solaris 9
jbonifaci
meha,
You have a huge problem with your loop, you can't use the same variable for both of your for loops, as the inner one will overwrite the outer one. Rename one or both of them to something unique and at least your loop will work. I'm not completely sure why you're even doing the loop though. Why don't you just do a getItem() on the item you are trying to get?
~Jeff
Migrateduser
How is the same variable being used? First, it's "allRootItems", then it's basically the children thereof with an IF statement in that block.
I have a number of other problems with that chunk of code, but I don't see where the same variable is being used in multiple loops.
Dave
Current Environments:
(1,2) TS 6.5 on W2K3
(3) Vignette V7 Portal on Solaris 9
jbonifaci
He's using for(i=0 ...){ and then inside that for loop he's using for(i=0 ...){ again, which is obviously bad...
~Jeff
meha
HI Dave,
Actuall im not allowed to upload the datacapture.cfg, so kindly excuse me for that.
But for the FOR loop, this one js file is referred by multiple datacapture, & the order of the fields may change, thats y im getting all root Item, check for the particular, conatiner, get all items, check for the particular item & then set the next item for focus.
The issue here is, there is a multi-select field, & when the end user, selects a value, by mistake if he just scrolls the mouse bar, the value changes. So on an itemChange, we trigger a function which sets focus to the next itemi n the loop ...
Hope its clear.
But now i tried hard-coding out of the replicant like :
--------------------------------------------------------------------------------
var hoursItem = IWDatacapture.getItem("/Automation/Abstract");
alert(hoursItem.getName());
hoursItem.setFocus();
alert(hoursItem.getName());
--------------------------------------------------------------------------------
The first alert comes, not the next one.
Can anyone try this out
Thanks,
Meha
Migrateduser
Oh, gotcha... I thought you were referring to the actual form elements.
Current Environments:
(1,2) TS 6.5 on W2K3
(3) Vignette V7 Portal on Solaris 9
meha
Hi Jeff,
Thanks for pointing that ... but dunno it was referring the item... copy/paste mistake..i have corrected it now.
But now someone pls help me .. what could be done.
Thanks
Meha
anisha
Hello Meha, do you any service packs on your 6.1 system? I think just 6.1 (with no service packs) has a bug wtih setFocus method.
meha
Hi All,
Thanks to everyone's reply ! This is a bug with teamsite 6.1 and can be solved by installing SP2.
Regards,
Meha