Hi ,
I have 2 dropdowns suppose "Dropdown1" and "Dropdown2" where Iam adding values from one dropdown1 to dropdown2 by using a dialog button "Add". Now the problem is Iam also able to add a same value of dropdown1 numerous times in dropdown2, which shouldnt happen. I need to have a check over there while adding values to dropdown2 i.e if the same value is already present in dropdown2, then I have to get a popup. Below is the code snippet :
In Datacapture.cfg:
<dialog type="button" label="Add" function="AddButton" >
</dialog>
In jvascript file:
function AddButton(item){
var accesscidItem1 = IWDatacapture.getItem("/Regional Access/Dropdown1");
var accesscidItem4 = IWDatacapture.getItem("/Regional Access/targetedcidcontainer/Targeted CID/Dropdown2");
var tempCIDAccess1 = new Array();
//var CIDnewOptions = new Array();
// Get all the selected values in an array
tempCIDAccess1 = accesscidItem1.getValue();
tempCIDAccess2 = accesscidItem4.getValue();
var length = accesscidItem1.getOptions().length;
var targetedcidformat = "";
for (i=0;i < length; i++){
var label1 = accesscidItem1.getOptions()[tempCIDAccess1[i]].text;
//alert("label1"+label1);
var value1 = accesscidItem1.getOptions()[tempCIDAccess1[i]].value;
targetedcidformat = value1 + " - " + label1;
CIDnewOptions = new Option(targetedcidformat, value1, false, false);
accesscidItem4.addOption(CIDnewOptions);
}
Could you guys please help me out of this or give me any clue on how to proceed.
Thanks in Advance,
Shyam