Hide Tabs on Select from Options list
-
10 Mayıs 2012 Perşembe 11:44
I have a form with a number of tabs.
I want to hide some tabs depending on what value I select from a options fropdown list.
Anyone know how to do this?
Tüm Yanıtlar
-
10 Mayıs 2012 Perşembe 11:52
write jscript on chabge of option list -
In javascript
1. get value of option set
Xrm.Page.getAttribute("OptionsetName").getValue();
2. check value and according to value hide/display tabs
Xrm.Page.ui.tabs.get("yourtabname").setVisible(true);
Xrm.Page.ui.tabs.get("yourtabname").setVisible(false);
Pooja
-
10 Mayıs 2012 Perşembe 11:53
function hideTabSection() { var option = Xrm.Page.getAttribute("nhs_guaranteetype").getSelectedOption().text; if (option == "YourText") { Xrm.Page.ui.tabs.get("yourTabname").setVisible(false); } else { Xrm.Page.ui.tabs.get("yourTabname").setVisible(true); } }
Put this function onChange of your Option Set.
For more information please check the following blogs
http://crmdm.blogspot.com/2011/03/how-to-hide-show-tab-in-crm-2011-using.html
http://crmdm.blogspot.com/2011/03/how-to-retrieve-optionset-text-value.html
I hope this helps. If my response answered your question, please mark the response as an answer and also vote as helpful.
Mubasher Sharif
Check out my about.me profile!
http://mubashersharif.blogspot.com
Linked-In Profile
Follow me on Twitter!
- Düzenleyen MubasherSharif 10 Mayıs 2012 Perşembe 14:31
- Yanıt Olarak İşaretleyen JMcCon 10 Mayıs 2012 Perşembe 14:38
-
10 Mayıs 2012 Perşembe 13:51
Thanks for the replies guys.
I have tried your solutions and they look fine but I keep getting the error <Message>Object expected</Message>
<Line>22</Line>Here is the code I am using:
function dcc_hideTabSection() {
if (Xrm.Page.getAttribute(“dcc_granttype”).getSelectedOption().text == "HD")
{
Xrm.Page.ui.tabs.get("HD_DisabledPerson").setVisible(false);
}
else
{
Xrm.Page.ui.tabs.get("HD_DisabledPerson").setVisible(true);
}
}Can anyone see what is wrong with this?
-
10 Mayıs 2012 Perşembe 14:07Moderatör
two things
1. Make sure you are using correct field names.
2.When you are copying code from somewhere make sure you are using correct quoteation sign
function dcc_hideTabSection() {
if (Xrm.Page.getAttribute("dcc_granttype").getSelectedOption().text == "HD") //quotation sign was wrong
{
Xrm.Page.ui.tabs.get("HD_DisabledPerson").setVisible(false);
}
else
{
Xrm.Page.ui.tabs.get("HD_DisabledPerson").setVisible(true);
}
}it should work now
Mahain : Check My Blog
Follow me on Twitter
Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question.- Yanıt Olarak İşaretleyen JMcCon 10 Mayıs 2012 Perşembe 14:37
-
10 Mayıs 2012 Perşembe 14:38
Thanks for all the help guys.
I got that working now.