Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Dynamics 365 general forum

error in documnt .getElementById

(0) ShareShare
ReportReport
Posted on by


var formType=Xrm.Page.getAttribute("test_formtype").getValue();

if(formType==693820000)//Non DR
{

radiobtn1 = parent.document.getElementById('1');
radiobtn1.checked = true;

}

this is my code which make radio button selection based on option set value but parent.document.getElementById is giving null. what shuld I do to support java script?

  • Dynamics365 Rocker Profile Picture
    7,755 on at
    RE: error in documnt .getElementById

    What is name of of your radio button field?

  • Suggested answer
    RaviKashyap Profile Picture
    55,410 Moderator on at
    RE: error in documnt .getElementById

    Hi Srishti,

    You need to write code in your HTML web resource which retrieves the value from your opportunity and based on that set the value of radio button.

    Hope this helps.

  • Community Member Profile Picture
    on at
    RE: error in documnt .getElementById

    on form load in opportunity form

  • Dynamics365 Rocker Profile Picture
    7,755 on at
    RE: error in documnt .getElementById

    Where are you calling this script?

  • Community Member Profile Picture
    on at
    RE: error in documnt .getElementById

    radio button is html web resource which i want to access by option set

  • Suggested answer
    Dynamics365 Rocker Profile Picture
    7,755 on at
    RE: error in documnt .getElementById

    Change your code as below:

    var formType=Xrm.Page.getAttribute("test_formtype").getValue();

    if(formType==693820000)//Non DR

    {

    radiobtn1 =Xrm.Page.getAttribute("Name of  radio button field").setValue(1);

    }

  • Piyush Paliwal Profile Picture
    817 on at
    RE: error in documnt .getElementById

    Can you please elaborate the scenario? From what I can see is that you are using unsupported JavaScripts. As part of D365 client scripting, you are not supposed to touch the DOM.

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard > Dynamics 365 general forum

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans