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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

not able to hide field in form using javascript used two times in a form

(0) ShareShare
ReportReport
Posted on by 2,385

I have used a single field two times in a form. when i hide it using javascript only one control gets hidden and no any change happening to other control. 

code is 

if(Xrm.Page.getAttribute("new_pendinglegaldocs").getValue() == true)
{
hideShowFields("new_describependingdocs", true);
}

Is anyone has idea how to achieve this. help will be appreciated.

Thanks,

Dilip

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Mathieu L Profile Picture
    100 on at

    Hi,

    You must use controls.forEach

    Xrm.Page.getAttribute("new_describependingdocs").controls.forEach(function (control, index)

       {

            control.setVisible(false);

       }

    );

  • gawasdilip Profile Picture
    2,385 on at

    thanks Mathiew,

    Could you please explain what to pass for control and index.

    I mean is it out of box function or custom function.

    is function("new_describependingdocs",2) is correct statement

    Thanks,

    Dilip

  • Amarsen Profile Picture
    55 on at

    You do not need to pass anything just use the above code and it should work fine. Actually CRM will pass the current control in context i.e. 'new_describependingdocs' and loop through every instance of the control that exists on the form.

  • gawasdilip Profile Picture
    2,385 on at

    Yes, It worked. thanks a lot

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans