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 and replicants
syim
I am having problem to set the visibility of some child items of a replicant item base on the value of another child item. For example, I have a replicant that contains a radio button and a text box. I want the text box to be visible only if the radio value is "yes"; otherwise the text box would be invisible.
Do anyone know how I can get this work? Should I register the item handler to the replicant or each radio item?
Thanks
Find more posts tagged with
Comments
Jens
You have to set the item handler on the radiobutton of each replicant instance like:
for(var i=1;i<8;i++){
IWEventRegistry.addItemHandler("/replicantname["+i+"]/radiobutton", "onItemChange", handle_changed);
}
then you can check the radiobutton and hide the text field or not.
if(item.getValue(0)){
IWDatacapture.getItem('/'replicant['+i+']/text').setVisible(true);
}
else{
IWDatacapture.getItem('/'replicant['+i+']/text').setVisible(false);
}
IWDatacapture.redraw();
i hope this will help you.
syim
Thanks for the help, but It doesn't work... Attached are the DCT and javascript. Most be my javascript contains errors so it does not work. Please let me know if any of you can see what's wrong with my javascript. Thanks.
BTW, the replicant contains no values when creating a new DCR. Can I still register a handler for each replicant instance that doesn't exist yet?
Jens
Try this:
function init() {
for (var i=1; i<51; i++) {
IWEventRegistry.addItemHandler("/relatedlink/links["+i+"]/new", "onItemChange", typeHandler);
}}
function typeHandler(typeItem) {
var item_name = typeItem.getName().split("/");
// get instance of replicant
var index = item_name[2].substring(item_name[2].lastIndexOf("[")+1, item_name[2].lastIndexOf("]"));
var flag = isNewWindow(typeItem);
......
......
......
syim
Thanks a lot!! It works.