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 :
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?

I have the same question (0)
  • Piyush Paliwal Profile Picture
    817 on at

    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.

  • Suggested answer
    Dynamics365 Rocker Profile Picture
    7,755 on at

    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);

    }

  • Community Member Profile Picture
    on at

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

  • Dynamics365 Rocker Profile Picture
    7,755 on at

    Where are you calling this script?

  • Community Member Profile Picture
    on at

    on form load in opportunity form

  • Suggested answer
    RaviKashyap Profile Picture
    55,410 Moderator on at

    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.

  • Dynamics365 Rocker Profile Picture
    7,755 on at

    What is name of of your radio button field?

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

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans