Click here to Skip to main content
15,918,193 members

Comments by Member 11571088 (Top 2 by date)

Member 11571088 27-Aug-15 11:04am View    
the error text is:

cannot call methods on dialog prior to initialization; attempted to call method 'open'.

jQuery version 1.9.1; jQuery UI version 1.10.3

I am setting the dialog options in a local javascript library and it looks like this:

$("#dialog-trouble").dialog({
title: "Trouble Information",
autoOpen: false,
height: 600,
width: 1000,
modal: true,
dialogClass: "no-close",
buttons: {
"Okay": {
class: 'okDialogButton',
text: 'OK',
click: function () {
var bValid = true;
var tType = $("#ddl_TType option:selected").val();
var tModule = $("#ddl_Module option:selected").val();
var thisNote = $('#troubleNote');
var notelength = thisNote.val();

bValid = bValid && checkLength(thisNote, "TroubleNote", 3, 2048);
bValid = bValid && (notelength.length > 2);
/* here is where you put the content of the note into the hidden variable.*/
if (bValid) {
$('#myTroubleNote').val(thisNote.val());
$('#myTroubleNote').change();
$('#myType').val(tType);
$('#myType').change();
$('#myModule').val(tModule);
$('#myModule').change();
$(this).dialog("close");
}
}
},
Cancel: function () {
$(this).dialog("close");
}
},
close: function () {
allFields.val("").removeClass("ui-state-error");
}
});


I did modify the original .dialog("open") call to .dialog({ autoOpen: false }).dialog("open") just to initialize the dialog before opening. That seems to work, somewhat. Now my Okay and Cancel buttons are not appearing and the dialog window is not picking up the size options in the open call.
Member 11571088 26-Aug-15 19:09pm View    
There is no error code. The code actually goes through the script that calls the dialog.("open"), but the "open" is never executed.