• Sadik Shaik 3
  • NEWBIE
  • 30 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 9
    Questions
  • 5
    Replies
Hi,

I am using a visualforce page to display the data in table fromat which fetch the data from external system using apex controller.
Now i have to enable the VF page to lightning so that i have added lightningstylesheet='true' in apex:page> tag and i have enabled Available for Lightning Experience, Lightning Communities, and the mobile app on visualforce page.
in th table i have a field label called ordernumber that is a command link in vf page.
when i click on the order number it sould open a popup window and display the content. it is workig in salesforce classic but i am getting below error in lightning.
Error:OMGetOpportunityOrderListPage?id=0061V00000h7FvXQAU&tour=&isdtp=p1&sfdcIFrameOrigin=https://hp--ngitdev.lightning.force.com&sfdcIFrameHost=web&nonce=0e2b097567482f81256e066fc4dfa917350111858dbe54a803b1d80747009f42&ltn_app_id=06m270000002x6ZAAQ&clc=0:30 Uncaught DOMException: Blocked a frame with origin "https://hp--ngitdev--c.cs8.visual.force.com" from accessing a cross-origin frame.
    at showBox (https://hp--ngitdev--c.cs8.visual.force.com/apex/OMGetOpportunityOrderListPage?id=0061V00000h7FvXQAU&tour=&isdtp=p1&sfdcIFrameOrigin=https://hp--ngitdev.lightning.force.com&sfdcIFrameHost=web&nonce=0e2b097567482f81256e066fc4dfa917350111858dbe54a803b1d80747009f42&ltn_app_id=06m270000002x6ZAAQ&clc=0:30:30)
    at a (https://hp--ngitdev--c.cs8.visual.force.com/apex/OMGetOpportunityOrderListPage?id=0061V00000h7FvXQAU&tour=&isdtp=p1&sfdcIFrameOrigin=https://hp--ngitdev.lightning.force.com&sfdcIFrameHost=web&nonce=0e2b097567482f81256e066fc4dfa917350111858dbe54a803b1d80747009f42&ltn_app_id=06m270000002x6ZAAQ&clc=0:1:18)
    at HTMLAnchorElement.onclick (https://hp--ngitdev--c.cs8.visual.force.com/apex/OMGetOpportunityOrderListPage?id=0061V00000h7FvXQAU&tour=&isdtp=p1&sfdcIFrameOrigin=https://hp--ngitdev.lightning.force.com&sfdcIFrameHost=web&nonce=0e2b097567482f81256e066fc4dfa917350111858dbe54a803b1d80747009f42&ltn_app_id=06m270000002x6ZAAQ&clc=0:1:421)
showBox @ OMGetOpportunityOrderListPage?id=0061V00000h7FvXQAU&tour=&isdtp=p1&sfdcIFrameOrigin=https://hp--ngitdev.lightning.force.com&sfdcIFrameHost=web&nonce=0e2b097567482f81256e066fc4dfa917350111858dbe54a803b1d80747009f42&ltn_app_id=06m270000002x6ZAAQ&clc=0:30
a @ OMGetOpportunityOrderListPage?id=0061V00000h7FvXQAU&tour=&isdtp=p1&sfdcIFrameOrigin=https://hp--ngitdev.lightning.force.com&sfdcIFrameHost=web&nonce=0e2b097567482f81256e066fc4dfa917350111858dbe54a803b1d80747009f42&ltn_app_id=06m270000002x6ZAAQ&clc=0:1
onclick @ OMGetOpportunityOrderListPage?id=0061V00000h7FvXQAU&tour=&isdtp=p1&sfdcIFrameOrigin=https://hp--ngitdev.lightning.force.com&sfdcIFrameHost=web&nonce=0e2b097567482f81256e066fc4dfa917350111858dbe54a803b1d80747009f42&ltn_app_id=06m270000002x6ZAAQ&clc=0:1


Please help me with this issue.

Thanks and Regards,
Sadik
HI,
When i click on the custom link it should open in a new window the below javascript should execute .
I have the below code:
<form method="POST" action="https://passport.hpe.com" id="myform" target="detail"> 
<input type="hidden" name ="TARGET" value="https://itcs.com/group/internal" /> 
<input type="submit" id="clickevent" value="submit" class = "submitforlogin"/></form> 
<iframe id="iframe" name="orderdetail" src="https://itcs.com/group/internal" ></iframe>
documnet.getElementsByClassName("submitforlogin")[0].click(); 
documnet.getElementsByClassName("submitforlogin")[0].style.display = 'None';

Please help me on this,
Regards,
Sadik
I have used the same code but i am getting the below error.
User-added image
Below is the code:
if (response.getStatusCode() == 200) {
string jsonresponse = response.getBody();
}
else if(response.getStatusCode() == 400){
sMessage = 'Bad Request: This response means that target system could not understand the request due to invalid syntax.';
displayMessage(sMessage);
}

Can anyone help me on this to cover the above lines of code in test class?
Thanks in Advance
Below is the code:
public class UtiityClassl{
public cls_data[] data;
public class cls_data {
public String customerName;
public String Id;
public String opportunityId;
public String Status;
public String Value;
}
public static UtilityClass parse(String json){
return (UtilityClass) System.JSON.deserialize(json, UtilityClass.class);
}
}

Can anyone please help me to write a test class for the above class;
Thanks in Advance
Below is my code:
<script type="text/javascript">
    function showBox(no) {
        var noval= document.getElementById(orderno).innerHTML;
        var box = new parent.SimpleDialog("helder"+Math.random(), true);
        parent.box = box;
        box.setTitle("Details");
        box.createDialog();
        box.setWidth(1300);
        box.setContentInnerHTML("<form method = \"POST\"action=\"https://google.com/\" target=\"orderdetil\"><input type=\"hidden\" name =\"TARGET\" value=\"https://www.w3schools.com/\" /><input type=\"submit\" id=\"clickevent\" value=\"submit\"/></form><input type=\"button\" style=\"background-color:#E01E0F;margin-top: 1px;margin-right: 2px;position:absolute;top:0;right:0;\" value=\"X\" onclick=\"box.hide();\"/><iframe name=\"orderdetail\" src=\"https://www.w3schools.com/\" height=\"500\" width=\"1280\" frameborder=\"0\" style=\"border:none; margin-left:0; margin-right: auto; height:600px;z-index:1;\"></iframe>");
        box.setupDefaultButtons();
        box.show();
</script>
Parent window:
function myFunction() {
    console.log('ele:::');
        //console.log('test'+document.getElementById("clickevent"));
        document.getElementById("clickevent").click();
        document.getElementById("clickevent").style.visibility = 'hidden';
        console.log('ele:::');
    }
For the above myfucntion iam getting null we should get id from chi;d window.
now i want to get the element id from showbox to my function
In setcontentinnserhtml i have input tag id that id i neeed to get to my function.
Anyone help me on this.
Thanks

below is my code:

<script type="text/javascript">
    function showBox(no) {
        var noval= document.getElementById(orderno).innerHTML;
        var box = new parent.SimpleDialog("helder"+Math.random(), true);
        parent.box = box;
        box.setTitle("Details");
        box.createDialog();
        box.setWidth(1300);
        box.setContentInnerHTML("<form method = \"POST\"action=\"https://google.com/\" target=\"orderdetil\"><input type=\"hidden\" name =\"TARGET\" value=\"https://www.w3schools.com/\" /><input type=\"submit\" id=\"clickevent\" value=\"submit\"/></form><input type=\"button\" style=\"background-color:#E01E0F;margin-top: 1px;margin-right: 2px;position:absolute;top:0;right:0;\" value=\"X\" onclick=\"box.hide();\"/><iframe name=\"orderdetail\" src=\"https://www.w3schools.com/\" height=\"500\" width=\"1280\" frameborder=\"0\" style=\"border:none; margin-left:0; margin-right: auto; height:600px;z-index:1;\"></iframe>");
        box.setupDefaultButtons();
        box.show();
</script>
In box.setcontentInnser Html i need to write a below function 
iframe.onload = function() {
        alert('HI');
        document.getElementById("clickevent").click();
        document.getElementById("clickevent").style.visibility = 'hidden';
        };

Can anyone please help me on this?
Thanks in Advance

Beloe is my code:
<script type="text/javascript">
    function showBox(no) {
        var noval= document.getElementById(orderno).innerHTML;
        var box = new parent.SimpleDialog("helder"+Math.random(), true);
        parent.box = box;
        box.setTitle("Details");
        box.createDialog();
        box.setWidth(1300);
        box.setContentInnerHTML("<form method = \"POST\"action=\"https://google.com/\" target=\"orderdetil\"><input type=\"hidden\" name =\"TARGET\" value=\"https://www.w3schools.com/\" /><input type=\"submit\" id=\"clickevent\" value=\"submit\"/></form><input type=\"button\" style=\"background-color:#E01E0F;margin-top: 1px;margin-right: 2px;position:absolute;top:0;right:0;\" value=\"X\" onclick=\"box.hide();\"/><iframe name=\"orderdetail\" src=\"https://www.w3schools.com/\" height=\"500\" width=\"1280\" frameborder=\"0\" style=\"border:none; margin-left:0; margin-right: auto; height:600px;z-index:1;\"></iframe>");
        box.setupDefaultButtons();
        box.show();
            console.log('inside Click Box onload:::');
            document.getElementById("clickevent").click();
            console.log('hi:::');
            document.getElementById("clickevent").style.display = 'none';  
    }
    </script>
Wheni use the id of input in "document.getElementById("clickevent").click();"  when i open the popup window  i am getting below error "TypeError: document.getElementById(...) is null",
Please anyone help me on this.
Quick response is very helpfull for me. .
Advance in Thanks,
Sadik
i Have two page block sections in a VF page. when i expand  one page block section the other page block section should get collapse similarly when i expand the other page block section the first page block section should get collapse.
Thanks in advance.
Close link code in java script:
<a href=\"#\" onclick=\"box.hide();\">Close</a>


I would like the user to not get redirected to the top of the page after close. how do we do that?
Thanks in advance
Below is the code:
if (response.getStatusCode() == 200) {
string jsonresponse = response.getBody();
}
else if(response.getStatusCode() == 400){
sMessage = 'Bad Request: This response means that target system could not understand the request due to invalid syntax.';
displayMessage(sMessage);
}

Can anyone help me on this to cover the above lines of code in test class?
Thanks in Advance
Below is the code:
public class UtiityClassl{
public cls_data[] data;
public class cls_data {
public String customerName;
public String Id;
public String opportunityId;
public String Status;
public String Value;
}
public static UtilityClass parse(String json){
return (UtilityClass) System.JSON.deserialize(json, UtilityClass.class);
}
}

Can anyone please help me to write a test class for the above class;
Thanks in Advance
Beloe is my code:
<script type="text/javascript">
    function showBox(no) {
        var noval= document.getElementById(orderno).innerHTML;
        var box = new parent.SimpleDialog("helder"+Math.random(), true);
        parent.box = box;
        box.setTitle("Details");
        box.createDialog();
        box.setWidth(1300);
        box.setContentInnerHTML("<form method = \"POST\"action=\"https://google.com/\" target=\"orderdetil\"><input type=\"hidden\" name =\"TARGET\" value=\"https://www.w3schools.com/\" /><input type=\"submit\" id=\"clickevent\" value=\"submit\"/></form><input type=\"button\" style=\"background-color:#E01E0F;margin-top: 1px;margin-right: 2px;position:absolute;top:0;right:0;\" value=\"X\" onclick=\"box.hide();\"/><iframe name=\"orderdetail\" src=\"https://www.w3schools.com/\" height=\"500\" width=\"1280\" frameborder=\"0\" style=\"border:none; margin-left:0; margin-right: auto; height:600px;z-index:1;\"></iframe>");
        box.setupDefaultButtons();
        box.show();
            console.log('inside Click Box onload:::');
            document.getElementById("clickevent").click();
            console.log('hi:::');
            document.getElementById("clickevent").style.display = 'none';  
    }
    </script>
Wheni use the id of input in "document.getElementById("clickevent").click();"  when i open the popup window  i am getting below error "TypeError: document.getElementById(...) is null",
Please anyone help me on this.
Quick response is very helpfull for me. .
Advance in Thanks,
Sadik
i Have two page block sections in a VF page. when i expand  one page block section the other page block section should get collapse similarly when i expand the other page block section the first page block section should get collapse.
Thanks in advance.
Close link code in java script:
<a href=\"#\" onclick=\"box.hide();\">Close</a>


I would like the user to not get redirected to the top of the page after close. how do we do that?
Thanks in advance