web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Make an attribute invisible or invisible

(0) ShareShare
ReportReport
Posted on by 35

I defined the OnChange() event of an attribute called IsCorrespondent (bit, displayed as two radio buttons: Customer and Correspondent) like this:

if (crmForm.all.apollo_iscorrespondent.DataValue==true) {
 crmForm.all.apollo_accountnumber.Visible=true;
 crmForm.all.IFRAME_ProductRanking.Visible=true;
}
else {
 crmForm.all.apollo_accountnumber.Visible=false;
 crmForm.all.IFRAME_ProductRanking.Visible=false;
}

I don't get any error, but nothing happens

What is wrong?

 

Thanks

*This post is locked for comments

I have the same question (0)
  • Andrew Zimmer Profile Picture
    340 on at

    For IFrame's you should be able to set the source to about:blank.  There is likely a way to set it using style, but this should get you going.

     crmForm.all.IFRAME_ProductRanking.src = "about:blank";

     As for hiding actual fields on the form, put these functions at the top of your OnLoad.


    OnLoad (above where they are called)

    document.HideElement = function(element) {
        if (element == null)
            return;

        element.style.visibility = 'hidden';
    }


    document.HideField = function(field) {
        var hidden = document.getElementById(field);
        if (hidden != null)
            document.HideElement(hidden);

        hidden = document.getElementById(field + "_c");
        if (hidden != null)
            document.HideElement(hidden);

        hidden = document.getElementById(field + "_d");
        if (hidden != null)
            document.HideElement(hidden);
    }


    document.ShowElement = function(element) {
        if (element == null)
            return;

        element.style.visibility = 'visible';
    }

    document.ShowField = function(field) {
        var hidden = document.getElementById(field);
        if (hidden != null)
            document.ShowElement(hidden);

        hidden = document.getElementById(field + "_c");
        if (hidden != null)
            document.ShowElement(hidden);

        hidden = document.getElementById(field + "_d");
        if (hidden != null)
            document.ShowElement(hidden);
    }

    Call them using:

        document.HideField('apollo_accountnumber');

    or

        document.ShowField('apollo_accountnumber');

     

    Hope this helps.

     -Andrew

  • RW Profile Picture
    35 on at

    Thanks Andrew, it does the trick

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
JS-09031509-0 Profile Picture

JS-09031509-0 3

#2
AS-17030037-0 Profile Picture

AS-17030037-0 2

#2
Mark Eckert Profile Picture

Mark Eckert 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans