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)

Read values from Iframe

(0) ShareShare
ReportReport
Posted on by

Hello, 

i have created an HTML page, that contains text and textboxes(nametxt,agetxt,nationalitytxt), i call this page using my iframe, how can i get the values (text) from these text boxes when i press save  ? 

your help is appreciated 

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Royal King Profile Picture
    27,686 on at

    You should be able to retrieve contents of iframe from parent page .

    Here is the sample code...

    var childiFrame = document.getElementById("iFrameID");

    var innerDoc = childiFrame.contentDocument  || childiFrame.contentWindow.document;

    // Get the Control inside iFrame Document.

    var yourChildiFrameControl = innerDoc.getElementById("childiFrameControlId");

  • Community Member Profile Picture
    on at

    its not working ..

    all i need is to save values in hidden fields when i save the form.

    and these values exist in the IFRAME

  • Verified answer
    Aileen Gusni Profile Picture
    44,524 on at

    Hi Alaa,

    Can you use this:

    var textBox1Value = document.frames.IFRAME_NAME.document.all.txtValue1.value;

    //replace to your textboxes:

    //(nametxt,agetxt,nationalitytxt)

    //and replace the IFRAME_NAME to your iframe name.

    Source:

    stackoverflow.com/.../accessing-controls-on-page-loaded-in-iframe-in-ms-crm-4-0-using-javascript

    Hope this helps!

    Thanks.

  • NatrajY Profile Picture
    3,040 on at

    Chitra's answer is correct. Just run

    document.getElementById('YOURIFRAMEID').contentDocument.getElementById('nametxt').value
    document.getElementById('YOURIFRAMEID').contentDocument.getElementById('agetxt').value
    document.getElementById('YOURIFRAMEID').contentDocument.getElementById('nationalitytxt').value

    from the browser developer console to see if they produce the desired values.

  • Community Member Profile Picture
    on at

    i got Access is denied Error!  and the website is added the Trusted sites list

  • Suggested answer
    Sayhaitokumar Profile Picture
    7,042 on at

    Hi AlaaMoh89,

    CRM doesn't allow to load some link in the iFrames. Ex:Google, Linkedin, Facebook.

    Please Check your Link.

  • Community Member Profile Picture
    on at

    Hello,

    my link is an HTML page that has been created by me

  • Suggested answer
    Sayhaitokumar Profile Picture
    7,042 on at

    Hi AlaaMoh89,

    In the properties window for the HTML web resource (within the form editor), is the checkbox "Restrict cross-frame scripting" checked or not checked? You will sometimes get Access Denied if the code crosses over to a different Web domain and if the setting I mentioned above is enabled.

  • Community Member Profile Picture
    on at

    Thank you saravanakumar VE,

    i got another Error which is : Permission denied !

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