Answered by:
Hide Section with JavaScript in CRM 2011

Question
-
Hi Forum!
Does anybody know how to hide a section in 2011! It seems to be totally different than in 4.0. Thanks for your help.
Kind regards
Tuesday, February 22, 2011 5:06 PM
Answers
-
I pulled this from Power Objects web site. It indicates that the SDK might have specific examples. Hope it helps:
Hide/Show a tab/section
Xrm.Page.ui.tabs.get(5).SetVisible(false);
Xrm.Page.ui.tabs.get(5).SetVisible(true);http://www.powerobjects.com/blog/2011/01/14/crm-2011-useful-javascript-tidbits/
- Marked as answer by CRMBE Wednesday, February 23, 2011 7:15 AM
Tuesday, February 22, 2011 7:26 PM
All replies
-
Take a look at the JavaScript Conversion tool as it will convert your 4.0 javascript to 2011. I think this will show you what you need.
http://crm2011scriptconvert.codeplex.com/
http://blogs.infinite-x.net/crm-add-ons/crm-migration-assistant/
Tuesday, February 22, 2011 5:31 PM -
Thanks Donna, but we tried it with the conversion tool, but it didn't work. Do you have the code maybe?Tuesday, February 22, 2011 5:42 PM
-
I pulled this from Power Objects web site. It indicates that the SDK might have specific examples. Hope it helps:
Hide/Show a tab/section
Xrm.Page.ui.tabs.get(5).SetVisible(false);
Xrm.Page.ui.tabs.get(5).SetVisible(true);http://www.powerobjects.com/blog/2011/01/14/crm-2011-useful-javascript-tidbits/
- Marked as answer by CRMBE Wednesday, February 23, 2011 7:15 AM
Tuesday, February 22, 2011 7:26 PM -
Ok, thanks Donna!Wednesday, February 23, 2011 7:15 AM
-
Wednesday, February 23, 2011 2:25 PM
-
I have written a couple of blog entries on the differences between CRM 4 and CRM 2011
http://crmbusiness.wordpress.com/2011/02/19/crm-2011-comparison-between-crm-4-0-and-crm2011-script/
and
http://crmbusiness.wordpress.com/2011/02/17/crm-2011-javascript-xrm-page-basics/
this is how you hide a section
Hide/Show a tab/section
Xrm.Page.ui.tabs.get(5).SetVisible(false);
Xrm.Page.ui.tabs.get(5).SetVisible(true);Wednesday, February 23, 2011 10:21 PM -
Thanks Ben!Thursday, February 24, 2011 7:11 AM
-
This is for a checkbox if it is clicked or not. Just pass the checkbox field, the tab number and the section number. Put in onLoad and in the onChange for your checkbox fields.
function HideShowSection(checkboxField,tabNumber,sectionNumber)
{
if (Xrm.Page.getAttribute(checkboxField).getValue() ==0)
{
Xrm.Page.ui.tabs.get(tabNumber).sections.get(sectionNumber).setVisible(false);
alert("This is being hidden!");
}
else
{
Xrm.Page.ui.tabs.get(tabNumber).sections.get(sectionNumber).setVisible(true);
}
}- Proposed as answer by Michael Karls Tuesday, April 5, 2011 4:06 PM
Tuesday, April 5, 2011 4:06 PM