opps sorry I spoke a little to soon... I figured out what your doing when before returns false it prevents the dialog from closing so really quite opposite of what I said previously in fact its a great way to determine if a dialog should close or not
hth Mike On Nov 20, 9:00 am, Mean Mike <[email protected]> wrote: > I think your confused about what beforeclose does, > > beforeclose doesn't close a dialog it does whatever you put in its > function right after dialog('close') is called > > so you would do somthing like this > > $(document).ready(function() { > $('#notesDialog').dialog({ > autoOpen: false, > width: 590, > resizable: false, > draggable: false, > bgiframe: true, > modal: true, > beforeclose: function(event, ui) { > return CloseNotesDialog(); > } > buttons: { > OK: function() { > $(this).dialog('close'); > } > } > }); > }); > > function CloseNotesDialog() > { > var subject = $('#<%= txtSubject.ClientID %>'); > var note = $('#<%= txtNote.ClientID %>'); > > if (subject.val() != '' || note.val() != '') > { > var pnlNotes = $('#<%= pnlNotes.ClientID %>'); > var pnlNotesConfirmation = $('#< > %=pnlNotesConfirmation.ClientID %>'); > > pnlNotesConfirmation.height(pnlNotes.height()); > pnlNotes.hide(); > pnlNotesConfirmation.show(); > > return false; > } > } > > and when the user clicks "OK" your CloseNoteDialog() function would be > called > > if your trying to determine if the dialog should close or not your > should do that in "OK"'s funtion > > Make sense ? > > Mike > > On Nov 19, 10:24 am, Nabeal <[email protected]> wrote: > > > I'm at a loss. I have hooked a beforeclose function, and that works > > fine. > > The issue that is killing me is when I want to close the dialog after > > the beforeclose returns false, nothing happens!! > > On the pnlNotesConfirmation there is a "No" button. On that "No" I > > try to perform: $('#notesDialog').dialog('close'); No event action > > occurs. > > > I tried the following line first: $('#notesDialog').dialog('option', > > 'beforeclose', function(ev, ui) {return true;}); > > Still it doesn't close. > > > The only way I got to work was by doing a destroy ($ > > ('#notesDialog').dialog('destroy'); ) then re init the dialog. That > > can't be right. What am I doing wrong. > > Using 1.7.2 > > > $(document).ready(function() { > > $('#notesDialog').dialog({ > > autoOpen: false, > > width: 590, > > resizable: false, > > draggable: false, > > bgiframe: true, > > modal: true, > > beforeclose: function(event, ui) { return CloseNotesDialog > > (); } > > }); > > }); > > > function CloseNotesDialog() > > { > > var subject = $('#<%= txtSubject.ClientID %>'); > > var note = $('#<%= txtNote.ClientID %>'); > > > if (subject.val() != '' || note.val() != '') > > { > > var pnlNotes = $('#<%= pnlNotes.ClientID %>'); > > var pnlNotesConfirmation = $('#<%= > > pnlNotesConfirmation.ClientID %>'); > > > pnlNotesConfirmation.height(pnlNotes.height()); > > pnlNotes.hide(); > > pnlNotesConfirmation.show(); > > > return false; > > } > > } -- You received this message because you are subscribed to the Google Groups "jQuery UI" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/jquery-ui?hl=.
