Hi,
i've got a problem with javascript. See the code below, it's an onload function and will load if the user opens a crm-contact. "new_land" is a dropdown menu.
function setVisibilitySonstigesLand()
{
var land= Xrm.Page.getAttribute("new_land").getSelectedOption().text;
if (land == "Sonstige")
{
Xrm.Page.ui.controls.get("address1_country").setVisible(true);
Xrm.Page.ui.controls.get("address1_country").setFocus();
}
}
The error is "cannot get a value for propertie "text" because the object is null or undefined".
If i insert an alert("hi"); just before var land = Xrm.Page.getAttr... it works without any problem.
Can you tell me how i get it to work without alert("hi"); ?
Thank you
Volker