locked
CRM 2011: Javascript: Object doesn't support property or method 'setSrc' RRS feed

  • Question

  • Hi there,

    I've a simple Javascript which sets an image in an iFrame on change of a field. Here is the code used:

    Xrm.Page.ui.controls.get("IFrame_Name").setSrc('/WebResources/SampleImage.png');
    Object doesn't support property or method 'setSrc'
    
    Tried this as well but no luck
    Xrm.Page.getControl("IFrame_Name").setSrc('../WebResources/NoImage.png'); 
    Object doesn't support property or method 'setSrc'

    Any idea about this?

    Thanks,
    Abhi

    Thursday, November 7, 2013 11:19 AM

Answers

  • Tried using Jquery like this.

    $(document).ready(function() {

    $(“#<attributename>”).attr(“scr”,”<resourcePath>”);

    });

    And this resolved the problem. Note than we need to include the JQuery library first in order to use above code.

    Thanks,
    Abhi

    • Marked as answer by Abhi D Monday, December 16, 2013 6:31 PM
    • Unmarked as answer by Abhi D Thursday, January 9, 2014 6:56 AM
    • Marked as answer by Abhi D Thursday, January 9, 2014 6:56 AM
    Monday, December 16, 2013 6:31 PM

All replies