Hi,
I'm using jquery-ui 1.6 custom build with jquery 1.2.6 trying to set up a dialog window. Unfortunately I can't update to 1.3.2 since this would trigger some unexpected XHR-related bugs like the following: Exception ``TypeError: M.xhr is not a function'' thrown from function anonymous(M=Object:{12}) in <http://localhost/media/js/jquery/jquery-1.3.2.min.js> So I'm sticking with the 1.2.6 build, which works fine despite a minor/not-critical XHR issue: Exception ``TypeError: s.accepts is undefined'' thrown from function anonymous(s=Object:{12}) in <http://localhost/media/js/jquery/jquery-1.2.6.pack.js> Notice that this error is reported in FireBug/Venkman, however Firefox doesn't seem to care and let the XMLHTTPRequest to execute successfully. The code for the dialog window is given below. I don't seem to understand why posted data cannot be shown on the dialog box twice. Moreover, it will display it as I want on the first $.post request but any additional requests triggered with a click event don't show any updated data on the dialog box. Venkman reports that the anonymous callback function manages to obtain the updated data, but still nothing get shown on the dialog, just an empty div... ;-) Any help or advices for debugging this issue? Best regards, Etienne This is the script that gets evaluated by jQuery (using $.get(...)). A json object is returned by the server either containing form validation errors or a result object that contains simple strings. <script type="text/javascript"> $(function(){ $('#'+'formControlBtn').bind('click', function(){ //send the form with a ajax request. on success, //return a "comment" preview. var formData = $('#'+'commentform').serialize(); //one-liner to remove old error messages before posting a new comment $('p.error').each(function(){$(this).remove()}); $.post('comment', formData, function(json) { var result = json.errordict || json.comment; if (result == json.comment) { // Look for the comment preview.. // Display a pop-up window (dialog) with the comment preview // in HTML. By clicking on "OK" or "Save" the user has no more // undo chances and the comment will be made. var commentHTMLDialog = $('<div id="commentDialog" class="ui-dialog ui-widget ui-content"><\/div>'); // Set a title $(commentHTMLDialog).attr('title', 'Preview comment'); // Setup default dialog constructor options $(commentHTMLDialog).dialog({ autoOpen: true, bgiframe: false, // must keep this for IE6? default = 'dont care' width: 500, modal: true, // prevent reposting while the dialog is enabled dialogClass: 'generic', height: 400, overlay: { backgroundColor: '#000', opacity: 0.5 }, buttons: { "It's all good, add my comment please." : function() { $(this).dialog('close'); }, Cancel: function() { $(this).dialog('close'); } }, open: function() { // Constructor to define what to do when opening // the dialog widget var commentHTMLBody = $("<ul id='commentHTMLBody'></ul>"); $(commentHTMLBody).prependTo($(commentHTMLDialog)); for (var x in result) { // create the "template" on the fly $('<li>'+x+': '+result[x]+'<\/li>').appendTo('#'+'commentHTMLBody'); }; } //open }); $(commentHTMLDialog).dialog('open'); return false; //$('#'+'commentForm').html('Thanks for your input!'); } else { // found some validation errors for (var x in result) { $('<p class="error">'+'<b>'+x+': <\/b>'+result[x]+'<\/p>').appendTo('#'+'commentForm'); }; }; }, "json"); return false; }); }); </script> -- Etienne Robillard <robillard.etie...@gmail.com> Green Tea Hackers Club <http://gthc.org/> Blog: <http://gthc.org/blog/> PGP Fingerprint: AED6 B33B B41D 5F4F A92A 2B71 874C FB27 F3A9 BDCC