kkonovalov Posted January 29, 2015 Report post Posted January 29, 2015 I am trying to add step to my HTA file, an extra OU value if Windows 8 checkbox is checked (OU=Windows8,) in front of the OU path that gets outputted (OUName). Currently my drop down contains the following: td colspan=1 class="taskTableLeftCell">OU</td> <td class="taskTableSpanSecondAndThirdCell"> <select name="OUName" id="OUName"> <option value="LDAP://OU=Administrative,OU=Workstations,DC=imo-online,DC=com" >Administrative</option> <option value="LDAP://OU=Development,OU=Workstations,DC=imo-online,DC=com" >Development</option> <option value="LDAP://OU=External,OU=Workstations,DC=imo-online,DC=com" >External</option> <option value="LDAP://OU=IT,OU=Workstations,DC=imo-online,DC=com">IT</option> <option value="LDAP://OU=Restricted,OU=Workstations,DC=imo-online,DC=com">Restricted</option> <option value="LDAP://OU=Sales,OU=Workstations,DC=imo-online,DC=com" >Sales</option> <option value="LDAP://OU=Service_Computers,OU=Workstations,DC=imo-online,DC=com" >Service Computers</option> </select> My checkbox says the following <input type>"checkbox" id="mycheck" value"OU=Win8,"/> Then I have my Java saying: function Win8() { var x=document.getElementById("myCheck").value; document.getElementsById("Win8").innerhtml=x; } The other java code is below which adds these 2 ou values together: var OUDrop = document.getelementById("OUName") + document.getElementById("Win8"); When I try to run this and proceed in my script I get an answer- Unable to get property 'undefined' of undefined or null reference. Not sure what I am doing wrong. Quote Share this post Link to post Share on other sites More sharing options...
anyweb Posted January 29, 2015 Report post Posted January 29, 2015 well this is wrong for starters <input type>"checkbox" id="mycheck" value"OU=Win8,"/> try <input type="checkbox" id="mycheck" value"OU=Win8"/> Quote Share this post Link to post Share on other sites More sharing options...
kkonovalov Posted January 29, 2015 Report post Posted January 29, 2015 I've tried both ways, but it wont output the second value, stating unable to get property "undefined" of undefined or null reference. Quote Share this post Link to post Share on other sites More sharing options...
anyweb Posted January 30, 2015 Report post Posted January 30, 2015 doesn't the error include any number, usually that points to the line it's failing on (line number) use NotePad ++ to edit your code, mistakes will show up easier Quote Share this post Link to post Share on other sites More sharing options...
Peter33 Posted January 30, 2015 Report post Posted January 30, 2015 this can't work var OUDrop = document.getelementById("OUName") + document.getElementById("Win8"); if (document.getElementById("mycheck").checked){ var win = "OU=Win8,"; } else { var win = ""; } var OU = document.getelementById("OUName").options[document.getelementById("OUName").selectedIndex].value; var OUName = "LDAP://" + win + OU; In this case you need to get rid of the LDAP:// prefix in your select. The question is why do you need a special OU for WIndows 8 Clients. It doesn't make much sense tou group your clients by OS in the AD. Quote Share this post Link to post Share on other sites More sharing options...