I am trying to iterate thru arrays and fill out form fields but it doesnt seem to work in ZP. Are functions in the JS window out of the question in ZP?
function setCom(){
CommPref = JSON.parse('{-Variable.myXML_userInfo-}');
if(CommPref['Tele'] == 'on'){
theEle = document.getElementById("contact_phone_ok");
theEle.checked = true;
theEle.style.border = '1px red dotted';
theEle = document.getElementById("contact_phone");
theEle.value= CommPref['phone'];
theEle.style.border = '1px red dotted';
}
if(CommPref['Text'] == 'on'){
theEle = document.getElementById("contact_text_ok");
theEle.style.border = '1px red dotted';
theEle.checked = true;
theEle = document.getElementById("contact_phone");
theEle.value= CommPref['phone'];
theEle.style.border = '1px red dotted';
}
if(CommPref['Email'] == 'on'){
theEle = document.getElementsByName("Privacy");
theEle[0].checked = true;
theEle[0].style.border = '1px red dotted';
}else{
theEle = document.getElementsByName("Privacy");
theEle[1].checked = true;
theEle[1].style.border = '1px red dotted';
}
if(CommPref['fName'] != ''){
theEle = document.getElementById("contact_name");
theEle.value = CommPref['fName'];
theEle.style.border = '1px red dotted';
}
return;
}
setCom();
function setCom(){
CommPref = JSON.parse('{-Variable.myXML_userInfo-}');
if(CommPref['Tele'] == 'on'){
theEle = document.getElementById("contact_phone_ok");
theEle.checked = true;
theEle.style.border = '1px red dotted';
theEle = document.getElementById("contact_phone");
theEle.value= CommPref['phone'];
theEle.style.border = '1px red dotted';
}
if(CommPref['Text'] == 'on'){
theEle = document.getElementById("contact_text_ok");
theEle.style.border = '1px red dotted';
theEle.checked = true;
theEle = document.getElementById("contact_phone");
theEle.value= CommPref['phone'];
theEle.style.border = '1px red dotted';
}
if(CommPref['Email'] == 'on'){
theEle = document.getElementsByName("Privacy");
theEle[0].checked = true;
theEle[0].style.border = '1px red dotted';
}else{
theEle = document.getElementsByName("Privacy");
theEle[1].checked = true;
theEle[1].style.border = '1px red dotted';
}
if(CommPref['fName'] != ''){
theEle = document.getElementById("contact_name");
theEle.value = CommPref['fName'];
theEle.style.border = '1px red dotted';
}
return;
}
setCom();