Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

How to diable lookup field from html web resource using javascript in ms crm 2015

(0) ShareShare
ReportReport
Posted on by 260

Hi,

I have a form and a custom html web resource.

In this form a have a lookup field. From the html web resource i wanto to disable the lookup field. Itried lots of thins , but none could solve my problem. I used codes like 

window.parent.opener.Xrm.Page.getAttribute("new_markalar").prop("disable", true)

window.parent.opener.Xrm.Page.getAttribute("new_magaza").setDisabled(true);

 crmForm.all.new_magaza.disabled = 'true';

How can i disaple the lookup field. Can anyone help me please?

*This post is locked for comments

  • altun8tr Profile Picture
    altun8tr 260 on at
    RE: How to diable lookup field from html web resource using javascript in ms crm 2015

    It works; thanks a lot I think you are a Crm professor

  • Verified answer
    a33ik Profile Picture
    a33ik 84,325 Most Valuable Professional on at
    RE: How to diable lookup field from html web resource using javascript in ms crm 2015

    You will have to play with parent/opener combinations to reference correct window (it's possible to check that using any browser debugger - I prefer Chrome for that purpose). But the last part - Xrm.Page.getControl("new_magaza").setDisabled(true); is 100% correct.

  • altun8tr Profile Picture
    altun8tr 260 on at
    RE: How to diable lookup field from html web resource using javascript in ms crm 2015

    I tried it. It gives me the error:

    TypeError: Cannot read property 'controls' of null

    /Boydak/_common/global.ashx?ver=1576068553:8

  • Suggested answer
    a33ik Profile Picture
    a33ik 84,325 Most Valuable Professional on at
    RE: How to diable lookup field from html web resource using javascript in ms crm 2015

    Hello,

    Try

    window.parent.Xrm.Page.getControl("new_magaza").setDisabled(true);

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,409 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans