Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Business Central forum

Got "Leave site? Changes you made may not be saved." message when I tried to close Sales Order page

(0) ShareShare
ReportReport
Posted on by 5

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.

61272105_2D00_e9df2280_2D00_a7d8_2D00_11e9_2D00_9c6a_2D00_a7237d67394f.png

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>

Categories:
  • Suggested answer
    Michal Cesek Profile Picture
    10 on at
    RE: Got "Leave site? Changes you made may not be saved." message when I tried to close Sales Order page

    We have the same issue. Looks like it's connected with JavaScript and iframe. However this is happening only in Google Chrome. Microsoft Edge works fine.

  • Shalabh Gupta Profile Picture
    91 on at
    RE: Got "Leave site? Changes you made may not be saved." message when I tried to close Sales Order page

    I am also facing a similar issue. 

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard > Business Central forum

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans