I added a action button in Sales Order page, after clicking this action button, it will popup a modal page. On this modal page, I added iframe and src is a third-party page through business central's controladdin object. This third-party page has a form, it has a textbox and submit button in the form. But after I submitted form data and closed modal page, if I click Back Arrow on Sales Order page, the following screenshot's message popuped.
If I continue to click 'Leave' button, business central seems to reset itself. It seems some issues happened. I don't want to show this message box and reset business central. Could anyone can help me to look into this issue? Is business central's itself issue?
My Business Central version is 14.0.29530.31705 and AL version is 3.0.145997
Following is my detailed code:
Control Add-In object code:
controladdin MyCrlAddInDemo
{
Scripts = 'https://code.jquery.com/jquery-2.1.0.min.js', 'Scripts/main.js';
StartupScript = 'Scripts/start.js';
RequestedWidth = 800;
RequestedHeight = 450;
MinimumWidth = 800;
MinimumHeight = 450;
MaximumWidth = 800;
MaximumHeight = 450;
HorizontalShrink = true;
VerticalShrink = true;
HorizontalStretch = true;
VerticalStretch = true;
event ControlReady()
procedure OpenPage()
}
start.js code:
Microsoft.Dynamics.NAV.InvokeExtensibilityMethod("ControlReady", []);
main.js code:
function OpenPage() {
$('#controlAddIn').html("<iframe id='pfTrxFrame' src='https://ourhost/TestSite' style='left:0px;top:2px;bottom:0px;right:0px;width:100%;height:440px;border: 0 none;'/>");
}
Modal page code:
page 50100 myIframePage
{
PageType = StandardDialog;
ApplicationArea = All;
UsageCategory = Administration;
Editable = false;
layout
{
area(Content)
{
usercontrol(myPage; MyCrlAddInDemo)
{
ApplicationArea = All;
trigger ControlReady()
begin
CurrPage.myPage.OpenPage();
end;
}
}
}
}
Extended Sales Order Page code:
pageextension 50100 SalesOrderExt extends "Sales Order"
{
layout
{
// Add changes to page layout here
}
actions
{
// Add changes to page actions here
addlast("P&osting")
{
action("Test")
{
ApplicationArea = All;
trigger OnAction()
var
myIframePage: Page myIframePage;
begin
myIframePage.Run();
end;
}
}
}
}
My HTML code in iframe:<form id="submitFm" action="/TestSite/Home/TestPOST" method="post" novalidate="novalidate"> <input id="txtnName" name="txtnName" type="text" value=""> <input type="submit" value="OK"> </form>