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)
Form API question:setVisible
mksiw
Hi,
I'm developing a DCT using form API and I'm running in to this issue. I'd attached the DCT and presented the formAPI code below.
I'm trying to hide/show Level3 when the isThereLevel3 radio button is checked for yes or no.
function init()
{
var FormField = new Array();
var FormFieldItem = IWDatacapture.getItem("/Type1/Level2");
FormField = FormFieldItem.getChildren();
var reqItem = FormField[2].getName();
var hideItem = FormField[4].getName();
IWEventRegistry.addItemHandler(reqItem, "onItemChange", showlevel3);
var it = showlevel3(IWDatacapture.getItem(reqItem,hideItem));
}
function showlevel3(item,hideItem)
{
var val = item.getOptions()[item.getValue()].value =="false";
IWDatacapture.getItem(hideItem).setVisible(val);
IWDatacapture.redraw();
var val = item.getOptions()[item.getValue()].value =="true";
IWDatacapture.getItem(hideItem).setVisible(val);
IWDatacapture.redraw();
}
Is there anything I'm missing, please let me know how to call an item inside an nested replicant.
Find more posts tagged with
Comments
mksiw
I attached the DCT again.
JonathonG
Here's a couple of issues. First, you have a syntax error. It's in this line:
var it = showlevel3(IWDatacapture.getItem(reqItem,hideItem));
IWDatacapture.getItem only takes one argument. I think its just a mis-placed closing paren. Here's the corrected line:
var it = showlevel3(IWDatacapture.getItem(reqItem),hideItem);
Second, when the event handler fires, only one parameter will be passed to "showlevel3" - the reqitem that changed. So, you probably want to make "hideItem" a global variable instead of passing it in to the function.
Finally, I'm not sure why you have 2 blocks of code in your function which do exactly the opposite thing from one another. Anything you might accomplish with your first block will be undone by the second block. Maybe this is just experimental code.
Jonathon
Independent Interwoven Contractor
mksiw
Thanks Jonathan for the valuable reply... I'll make the corrections and try it out.