简体   繁体   English

使用JavaScript将参数传递给Dynamics CRM中的IFRAME

[英]Passing parameters to IFRAME in Dynamics CRM using javascript

I've following code snippet to access http://localhost:80/testsite in IFRAME. 我按照以下代码片段访问了IFRAME中的http://localhost:80/testsite It worked fine but as soon as I went to pass the fields value as parameter nothing get happen. 它工作正常,但是一旦我将fields值作为参数传递,什么也没发生。 I tried directly access the page from browser with parameters so page is behaving fine. 我尝试使用参数直接从浏览器访问页面,因此页面运行正常。 I cannot figure out the things after spending a lot of time. 我花了很多时间后无法弄清楚事情。 I would like to seek your kind patience on this basic question. 我想请您耐心等待这个基本问题。

code Snippet 代码段

function forwardValues(){
    var ordername = Xrm.Page.getAttribute("name").getValue();
    var IFrame = Xrm.Page.ui.controls.get("IFRAME_sendvalue");
    var Url = IFrame.getSrc();

    var params = Url.substr(Url.indexOf("?"));

    var param1 = Url+"?ordername="+ordername;

    IFrame.setSrc(param1);

}

Try to use following code: 尝试使用以下代码:

function forwardValues(){
   var ordername = Xrm.Page.getAttribute("name").getValue();
   var IFrame = Xrm.Page.ui.controls.get("IFRAME_sendvalue");
   var Url = IFrame.getSrc();
   if (Url.indexOf("?") != -1)
       Url = Url.substr(0, Url.indexOf("?"));
   var param1 = Url+"?ordername="+ordername;
   IFrame.setSrc(param1);
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM