简体   繁体   中英

How to hide a section in dynamics crm 2011

So I have a form with 3 sections. I want a functionality where Section 1 gets filled than section 2 shows up and so on.

I know the basic code of JavaScript but I don't know where to use it or how to invoke it. I have made a web resource with SHOW and HIDE functions, now how do I invoke them.

I am currently working the idea of using JAVA SCRIPT to hide the sections and show the latter sections when the former gets filled up. Here is my code.

function Hide()
{ Xrm.Page.ui.tabs.get("yourtabname").sections.get("your section name").setVisible(false); } 
function Show()
{ Xrm.Page.ui.tabs.get("yourtabname").sections.get("your section name").setVisible(true); } 

Now I am aware that Show() will get attached to the last field of section 1 of the form, but what about the Hide() function? where will I invoke it?

Firstly i guess it's a personal preference however I would have a "validate" function and ensure you have all the information you need before hiding the first section (what happens if they enter the last field first for instance?)

Then I would just do something like the following and call it on all fields in the section:

function SectionOneField_OnChange()
{
    if (IsSectionOneValid())
    {
         Xrm.Page.ui.tabs.get("NextTab").sections.get("NextSection").controls.get(0).setFocus();
         Xrm.Page.ui.tabs.get("FirstTab").sections.get("SectionOne").setVisible(false);
    }
}

Side note : As with most CRM javascript this probably isn't Microsoft supported :-)

I came across this while looking for code for something similar. Don't think it's exactly what you want but it may help!

http://www.magnetismsolutions.co.nz/blog/11-06-28/Show_a_Tab_Based_on_a_Radio_Button_Dynamics_CRM_2011.aspx

The guy has a few other useful articles on Dynamics CRM 2011 too.

We can use this code for hiding/show tab:

Show:

Xrm.Page.ui.tabs.get("TabName").setVisible(true);

Hide:

Xrm.Page.ui.tabs.get("TabName").setVisible(false);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM