Hi,We have a business requirement where We are suppose to hide a field in a container based upon the user option choice.Meaning there wise either the container should open or else it hides.Now when in my JS Script I try this:IWDatacapture.getItem("/GeneralText/General Settings/Block/Block1").setVisible(false);The code runs fine when container Block container has max as 1.Now when the Block is set to more than 1,suppose 2 obviously I will have to write the code as:IWDatacapture.getItem("/GeneralText/General Settings/Block[2]/Block1").setVisible(false); and so onbut during testing the code doesn't run?Can anybody suggest that how can We do setVisible in this scenario.Thanks
Is the option that you're setting to determine whether to hide the 'Block1' field within the 'Block' container (1:1 relationship) or somewhere else higher up the hierarchy ('GeneralText' or 'GeneralSettings' - a 1:N relationship)?In general - you'd use an onItemChange event handler to do the toggling of the item visibility but you'd also need something to traverse the entire DCR structure when an existing DCR is loaded to do the toggling for that.The code you need to write depends on the relationship between the item controlling the toggle and the item being toggled - but generally you want to write one function that, given the correct 'Block' container item hides (or makes visible) the 'Block1' item - and another function that traverses the DCR structure (using the getChildren() function) that calls the other function as needed. You should not be hard-coding the xpath to a particular instance of a replicated item in your code.