function OnCrmPageLoad()
{
//Hide the Second Section in the first Tab
ToggleSection( 0 , 1 , "none" /* "inline" */);
}
// Tabs and Section Collections are zero based
function ToggleSection( tabIndex , sectionIndex , displayType )
{
var sec = document.getElementById( "tab" + tabIndex );
sec.childNodes[0].rows[ sectionIndex ].style.display = displayType;
}
//Entry Point
OnCrmPageLoad();
So Long, and Thanks for All the Fish
2 years ago
8 comments:
The section hidden with this techinique does showup when Case is resolved and Case Form is read-only.
Is there any solution to this?
Tag: CRM 4.0, Hide section, readonly, disabled
If you add a simple alert(); does it work?
Thanks, I used the following in the "OnLoad" event of the form (form customization in MS CRM 4.0)
# var sec = document.getElementById( "tab" + tabIndex );
# sec.childNodes[0].rows[ sectionIndex ].style.display = displayType;
I replaced tabIndex, sectionIndex & displayType with my values & it worked like a charm :)
Cheers...
I used your code to make all fields in a section readonly. Now how do I re-enable them?
//Hide Pricing Fields unless New Pricing
//
ReadOnlyPricing = function (tab, section) {
//Hide the Second Section in the first Tab
ToggleSection(tab, section, "true" /* "inline" */);
}
ToggleSection = function(tabIndex, sectionIndex, displayType) {
var sec = document.getElementById("tab" + tabIndex);
sec.childNodes[0].rows[sectionIndex].disabled = displayType;
}
//Hide Pricing Fields unless New Pricing
//
EnablePricing= function(tab, section) {
//Hide the Second Section in the first Tab
ToggleSection(tab, section, "false" /* "inline" */);
}
Adi,
Your code works fine. However, in an IFD environment with SSL (https:// server), when I hide a section, the form pops up a message stating that some of the content is not secured (mixing http and https). The message goes away when I disable the section hiding code. Any ideas?
Alejandro
It seems I found the issue. The problem arises if the page has not fully loaded when I execute the code hiding the section.
I attached it to an onchange event - then didn't happen. If I place it in the onload, and runs without waiting till all the window is loaded, it breaks somehow.
Now... I have to find a way to wait till the page is loaded to execute the hide section statement.
Alejandro
Thanks :))
Post a Comment