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)
Dynamic initial-dir on <browser> tag
dlukezic
Hi everyone! I have a DCT where I am allowing the user to select a language (English or French) in a radio button selection. Based on this selection, I want to set a different initial-dir in my <browser> tag. Does anyone know if this is even possible? If it is, does anyone have some sample code?
Thanks in advance!
Doreen
Find more posts tagged with
Comments
herald10
You can use FormAPI to accomplish this. The first step would be to associate an event handler with that radio button. Within the event handler function you can change the value of the browser item. Please check the examples provided with Teamsite installation on FormAPI. There are a couple of them.
Hope this helps
-H
dlukezic
I don't want to change the value of the browser item though. I want to change the initial-dir attribute of the browser item.
Doreen
Migrateduser
I don't think there's any supported way (so it may break with a future release, so put it in a function so you only have to fix it in one place), but I think it is possible. Loop through all properties of item.itemImpl.attributes.values or whatever to confirm which property to set (probably just 'initial-dir'). Then something like:
item.itemImpl.attributes.values['initial-dir'] = /'whatever';
I do this with label, ceiling, etc. but haven't tried with initial. There may be a better way.
Edited by john on 07/22/04 12:40 PM (server time).
dlukezic
Thanks for the idea! I will give it a try! I'm wondering if there is a way through the FormAPI that I can create and delete fields on the DCT? That would allow me to create and delete the whole field with attributes as needed.
Thanks,
Doreen
Migrateduser
I don't think there's any way to create opr remove (and if there were I probably wouldn't go that route), but you can make them invisible, readonly and/or not required (make sure you set all children to not required when you hide something or make it readonly or your users won't be able to save). They will still appear in the DCR but have null values. This way your DCR XML is always the same, regardless of which options are enabled in the DCT. You may have to redraw.
Crikey, seems like FormAPI could ship with a lot more functionality. I think the last FormAPI library I worked on grew to about 100K. This can result in performance degredation, so now I break the libraries into sublibs and document externally.
iwovGraduate
"....way through the FormAPI that I can create and delete fields on the DCT"
If I undertand correctly what you are suggesting, you will open DCT, based on some conditions do a callserver, modify DCT and reload DCT. Besides performance, you might run into issues if you had DCRs with fields that you are deleting in DCT. I wouldn't want to do that.
If you have a DCT that changes frequently,
maybe
what you are trying to achieve is not a good candidate for templating.
As for your original query - you can write a custom callout instead of OOTB <browser> tag.
xaxislabelrotation.JPG
tsrookie
Hi all,
Heres an idea, just thinking aloud but. Could one create two instances of the browser tag in separate containers each with the path depending on what language was chosen, then if the user changes the radio button you show/hide the appropriate container.
Regards
Colin
Migrateduser
I've been working on something similar (Solaris 8, TS 5.5.2, SP6), but haven't been able to get it to work either. I have four browse items with different ceiling-dirs. Each of those items have to have replicants within them, and I was trying to get them to show/hide (the main items not the replicants within) based on the value of a drop-down menu selection earlier in the DCR.
Here is the partial code: where "business" is the location value item.
// The determinepath function sets one of the photo replicants visible depending on the business location selected by the Author. The photo replicants have business-specific image paths for thumbnails.
/*function determinepath() {
var bus = IWDatacapture.getItem("/business").getValue();
alert(bus);
if (bus==1) {
alert("blah");
IWDatacapture.getItem("/appliancesPhotos").setVisible(true);
IWDatacapture.getItem("/lightingPhotos").setVisible(false);
IWDatacapture.getItem("/electricalPhotos").setVisible("false");
IWDatacapture.getItem("/companyPhotos").setVisible("false");
alert("redraw");
IWDatacapture.redraw();
alert("worked");
}
else if (bus==2) {
IWDatacapture.getItem("/appliancesPhotos").setVisible(false);
IWDatacapture.getItem("/lightingPhotos").setVisible(true);
IWDatacapture.getItem("/electricalPhotos").setVisible(false);
IWDatacapture.getItem("/companyPhotos").setVisible(false);
}
else if (bus==3) {
IWDatacapture.getItem("/appliancesPhotos").setVisible(false);
IWDatacapture.getItem("/lightingPhotos").setVisible(false);
IWDatacapture.getItem("/electricalPhotos").setVisible(true);
IWDatacapture.getItem("/companyPhotos").setVisible(false);
}
else if (bus==4) {
IWDatacapture.getItem("/appliancesPhotos").setVisible(false);
IWDatacapture.getItem("/lightingPhotos").setVisible(false);
IWDatacapture.getItem("/electricalPhotos").setVisible(false);
IWDatacapture.getItem("/companyPhotos").setVisible(true);
}//close last if statement
//alert("redraw");
//IWDatacapture.redraw();
//alert("worked");
}//close determinepath subfunction
*/
IWEventRegistry.addItemHandler("/business", "onItemChange", business_onItemChange);
So far it has died within the first if statement. So if anyone has a suggestion I would be happy to hear it.
If I find out anything I'll post as well.
Thanks,
Carol
What goes up must come down. Ask any system administrator.