Note that there are some explanatory texts on larger screens.

plurals
  1. POModal dialogs from within a tabbed UI (Improved example)
    primarykey
    data
    text
    <p>(I have tightened up my original example) I'm trying to invoke modal dialogs from within a tabbed UI, and I'm confused about the behavior I'm seeing. The first time I display the UI, my dialog behaves as expected, I can pull the data out of the fields, everything's wonderful.</p> <p>tabtest2.html:</p> <pre><code>&lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"&gt; &lt;head&gt; &lt;title&gt;Tabtest 2&lt;/title&gt; &lt;link rel="stylesheet" type="text/css" href="js/css/smoothness/jquery-ui-1.7.2.custom.css" media="screen"/&gt; &lt;script type="text/javascript" src="js/jquery.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="js/jquery-ui-1.7.2.custom.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; jQuery(document).ready(function() { var tabs = $('#tabs').tabs({ load: function(event, ui) { initializeUI(); } }); }); function initializeUI() { jQuery("#button1").click(function() { $(initializeUI.win).dialog("open"); }); $(initializeUI.win) = jQuery("#window1"); //instantiate the dialog $(initializeUI.win).dialog({ height: 350, width: 400, modal: true, position: 'center', autoOpen:false, title:'Create Agent', overlay: { opacity: 0.5, background: 'black'}, buttons: { "Check Text 1": function() { var t1 = $("#text1"); alert("text 1 = " + t1.val()); }, "Close": function() { $(initializeUI.win).dialog("close"); } } }); } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="tabs"&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="tab1.html"&gt;Tab1&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="http://google.com"&gt;Google&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>And tab1.html</p> <pre><code>&lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"&gt; &lt;head&gt; &lt;title&gt;Tab 1&lt;/title&gt; &lt;script type="text/javascript" src="js/jquery.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="js/jquery-ui-1.7.2.custom.min.js"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;button id="button1" class="ui-button ui-state-default ui-corner-all"&gt;Button 1&lt;/button&gt; &lt;div id="window1" style="display:none"&gt; &lt;form&gt; &lt;fieldset&gt; &lt;label for="text1"&gt;Text 1&lt;/label&gt; &lt;input type="text" name="text1" id="text1" class="text ui-widget-content ui-corner-all" /&gt; &lt;/fieldset&gt; &lt;/form&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>This allows the dialog to (apparently) work on repeated tab selections, but when I try to change the contents of the text field and examine it, I get the old value (the value from the first invocation)!! It's as if I have created a new copy of the dialog and it's fields, but the original text field is sitting there unseen in the original dialog window, returning it's old results. </p> <p>Obviously, there's a paradigm for handling these dialogs, divs and tabs that I haven't grasped yet. Anyone care to point out my errors? </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload