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

UI issue when using JavaScript onChange to show/hide section containing subgrid

$
0
0

I have a section on a custom entity's Information form that contains a couple fields and a sub-grid of contacts (labelled participants). When I use the below JavaScript to show/hide that section based on another field selection, under certain circumstances it consistently appears incorrectly. This only occurs when I have the record saved in a way where this section is hidden, and then I change the field that triggers it to display. If I then save the record and refresh it, it displays properly. It would seem that the onLoad JavaScript works fine, but when I call the same function as an onChange for the pll_service field it is appearing as shown in the image below. Any thoughts on this? Functionality doesn't seem to be impacted, it just looks wrong.

 

JavaScript used: (called as an onLoad function and as an onChange function for the pll_service field which is an option set data type)

function trainingIncluded(){
var trainingStatus = Xrm.Page.getAttribute("pll_service").getText();
if(trainingStatus != "Training")
{
Xrm.Page.ui.tabs.get("General_Tab").sections.get("Training").setVisible(false);
}
else
{
Xrm.Page.ui.tabs.get("General_Tab").sections.get("Training").setVisible(true);
}
}

 

Image of issue: (Note how the label of "Participants" as well as the buttons for adding records/viewing grid are shown within the column headers instead of above)

 


Viewing all articles
Browse latest Browse all 46379

Trending Articles



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