Hi Community,
i have one option set with 5 options,
and i have 5 fields in my form,
on load option set value is zero all the fields will be hide
on change if i select option like a the filed a only show remaining will be hide
i write using if else condition and its working
But i want to write using Switch statement
code is
function filterfields()
{
var firstPickListValue = Xrm.Page.getAttribute("new_options").getValue();
if (firstPickListValue == null)
{
Xrm.Page.ui.controls.get("new_a").setVisible(false);
Xrm.Page.ui.controls.get("new_b").setVisible(false);
Xrm.Page.ui.controls.get("new_c").setVisible(false);
Xrm.Page.ui.controls.get("new_d").setVisible(false);
Xrm.Page.ui.controls.get("new_e").setVisible(false);
}
else if(firstPickListValue == 10,00,00,000)
{
Xrm.Page.ui.controls.get("new_a").setVisible(true);
Xrm.Page.ui.controls.get("new_b").setVisible(false);
Xrm.Page.ui.controls.get("new_c").setVisible(false);
Xrm.Page.ui.controls.get("new_d").setVisible(false);
Xrm.Page.ui.controls.get("new_e").setVisible(false);
}
else if(firstPickListValue == 10,00,00,001)
{
Xrm.Page.ui.controls.get("new_b").setVisible(true);
Xrm.Page.ui.controls.get("new_a").setVisible(false);
Xrm.Page.ui.controls.get("new_c").setVisible(false);
Xrm.Page.ui.controls.get("new_d").setVisible(false);
Xrm.Page.ui.controls.get("new_e").setVisible(false);
}
else if(firstPickListValue == 10,00,00,002)
{
Xrm.Page.ui.controls.get("new_c").setVisible(true);
Xrm.Page.ui.controls.get("new_a").setVisible(false);
Xrm.Page.ui.controls.get("new_b").setVisible(false);
Xrm.Page.ui.controls.get("new_d").setVisible(false);
Xrm.Page.ui.controls.get("new_e").setVisible(false);
}
else if(firstPickListValue == 10,00,00,003)
{
Xrm.Page.ui.controls.get("new_d").setVisible(true);
Xrm.Page.ui.controls.get("new_a").setVisible(false);
Xrm.Page.ui.controls.get("new_b").setVisible(false);
Xrm.Page.ui.controls.get("new_c").setVisible(false);
Xrm.Page.ui.controls.get("new_e").setVisible(false);
}
else if(firstPickListValue == 10,00,00,004)
{
Xrm.Page.ui.controls.get("new_e").setVisible(true);
Xrm.Page.ui.controls.get("new_a").setVisible(false);
Xrm.Page.ui.controls.get("new_b").setVisible(false);
Xrm.Page.ui.controls.get("new_c").setVisible(false);
Xrm.Page.ui.controls.get("new_d").setVisible(false);
}
}
*This post is locked for comments