Jquery Mobile 1.4.3 dialog display incorrect (the from page display dialog content) when press back button

Jquery Mobile 1.4.3 dialog display incorrect (the from page display dialog content) when press back button

JQuery mobile dialog display incorrect after pressed back button.

  1. First time run

  2. Click open dialog button

  3. Clicked back button 

  4. Click open dialog button again 

The dialog page content will copied to the from page after clicked back button. This will happen after added jquery-ui. It seems there is conflict between jquery mobile dialog and jquery ui. Or it will be normal if the dialog content is just several lines only.

Here is my code: 

1.From Page


  1. @{ 
  2.    Layout = null;
  3. }

  4. <!DOCTYPE html>
  5. <html>
  6. <head>
  7.     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  8.     <meta charset="utf-8" />
  9.     <title>@ViewBag.Title</title>
  10.     <meta name="viewport" content="width=device-width" />

  11.     <link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.1/themes/smoothness/jquery-ui.css" />
  12.     <link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jquerymobile/1.4.3/jquery.mobile.min.css" />

  13.     @*
  14.     <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>*@
  15.     <script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

  16.     <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.1/jquery-ui.min.js"></script>
  17.     <script src="//ajax.googleapis.com/ajax/libs/jquerymobile/1.4.3/jquery.mobile.min.js"></script>
  18. </head>
  19. <body>
  20.     <div data-role="page" class="jqm-demos" data-quicklinks="false" id="page1" style="height:600px">
  21.         <div data-role="header" class="jqm-header">
  22.             <h2>
  23.                 Test
  24.             </h2>
  25.         </div><!-- /header -->

  26.         <div role="main" class="ui-content jqm-content" id="mainContent">
  27.             @using (Html.BeginForm(null, null, FormMethod.Post, new { @id = "form10" }))
  28.             {
  29.             <div data-role="controlgroup" data-type="horizontal" data-mini="true">
  30.                 <a href='@Url.Action("TestDialogPage", "Test")' class="ui-shadow ui-btn ui-corner-all ui-btn-inline" data-transition="pop">Open dialog</a>
  31.             </div>

  32.             }


  33.         </div><!-- /content -->

  34.     </div>
  35. </body>
  36. </html>

  37. <script>
  38.     $(document).on("mobileinit", function () {
  39.         $.mobile.ajaxEnabled = false;
  40.     });

  41. </script>

  • 2.Dialog Page


    1.    @{
    2.   ViewBag.Title = "Test Dialog";
    3.     ViewBag.Save = "Save";
    4.     ViewBag.Back = "Back";
    5.     Layout = null;
    6. }

    7. <!DOCTYPE html>

    8. <html>
    9. <head>
    10.     <meta name="viewport" content="width=device-width" />
    11.     <title>Test Dialog</title>
    12. </head>
    13. <body>
    14.     @*<div id="TestInfoDialog" data-role="dialog">*@

    15.     <div id="TestInfoDialog" data-role="page" data-dialog="true">
    16.         <div data-role="header" data-position="fixed">
    17.             <a data-rel="back" data-icon="back">@ViewBag.Back</a>
    18.             <h2>@ViewBag.Title</h2>
    19.         </div>

    20.         <div class="ui-content" role="main">
    21.             <form id="TestInfoForm">
    22.                 <div>
    23.                     @Html.Label("test1")
    24.                     @Html.TextBox("test1")
    25.                     @Html.Label("test1")
    26.                     @Html.TextBox("test1")
    27.                     @Html.Label("test1")
    28.                     @Html.Label("test1")
    29.                     @Html.Label("test1")
    30.                     @Html.TextBox("test1")
    31.                     @Html.Label("test1")
    32.                     @Html.TextBox("test1")
    33.                     @Html.Label("test1")
    34.                     @Html.Label("test1")
    35.                     @Html.Label("test1")
    36.                     @Html.TextBox("test1")
    37.                     @Html.Label("test1")
    38.                     @Html.TextBox("test1")
    39.                     @Html.Label("test1")
    40.                     @Html.Label("test1")
    41.                     @Html.Label("test1")
    42.                     @Html.TextBox("test1")
    43.                     @Html.Label("test1")
    44.                     @Html.TextBox("test1")
    45.                     @Html.Label("test1")
    46.                     @Html.Label("test1")
    47.                 </div>
    48.             </form>
    49.         </div>

    50.     </div>
    51. </body>
    52. </html>

    Thanks

    Wilson