Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 82002

Show or Hide section on form load based on field

$
0
0

I am having an issue with Javascript when loading a page.  I need to show or hide a section based on a fields value from a drop down.  The sections are showing/hiding properly when the field is changed but does not run when the form loads.  It is set to run OnLoad in the event handler in Form Properties.  To be clear I want it to show/hide depending on the field when the page loads as well as when the field changes.  Below is my code.

function showHide()
{
Xrm.Page.getAttribute("vent_marketinglistdivision").addOnChange(function(){
var vent_marketinglistdivision =Xrm.Page.getAttribute("vent_marketinglistdivision").getValue();
if(vent_marketinglistdivision == 693450003)
Xrm.Page.ui.tabs.get("tabAssociate").sections.get("VPIT").setVisible(true);
else
Xrm.Page.ui.tabs.get("tabAssociate").sections.get("VPIT").setVisible(false);
});
Xrm.Page.getAttribute("vent_marketinglistdivision").addOnChange(function(){
var vent_marketinglistdivision =Xrm.Page.getAttribute("vent_marketinglistdivision").getValue();
if(vent_marketinglistdivision == 693450005)
Xrm.Page.ui.tabs.get("tabAssociate").sections.get("VTST").setVisible(true);
else
Xrm.Page.ui.tabs.get("tabAssociate").sections.get("VTST").setVisible(false);
});
}


Viewing all articles
Browse latest Browse all 82002

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>