Hiding/Showing Section Dynamically based on Picklist Value -- (Supported)
In Real Scenario, developers use to get many client requirements especially on PickList change, here i have taken one example of Showing and Hiding Sections/Tabs based on PickList change.
PickList field name = "new_picklist"
Write this script in the onchange of the PickList field.
function pickOnchange()
{
var pValue = Xrm.Page.getAttribute("new_picklist").getValue();
if(pValue=="1")
{
ToggleSection(0,1,false);
}
if(pValue=="2")
{
ToggleSection(0,1,true);
}
{
ToggleSection(0,1,false);
}
if(pValue=="2")
{
ToggleSection(0,1,true);
}
function ToggleSection(tabIndex, sectionIndex, displayType)
{
Xrm.Page.ui.tabs.get(tabIndex).sections.get(sectionIndex).setVisible(displayType);
}
{
Xrm.Page.ui.tabs.get(tabIndex).sections.get(sectionIndex).setVisible(displayType);
}
}
Also we can hide the tab ...
Xrm.Page.ui.tabs.get(tabIndex).setVisible(displayType);
Note : We can also pass Name of the Tab and Section instead of Index.
No comments:
Post a Comment