EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: y.bykov on July 01, 2016, 08:59:46 AM



Title: Get error when close dialog
Post by: y.bykov on July 01, 2016, 08:59:46 AM
I catch error message when I close dialog with a form.
Quote
Uncaught TypeError: Cannot read property 'options' of undefined

_49e   @   VM24260:6435
(anonymous function)   @   VM24260:6555
m.extend.each   @   jquery-1.11.3.min.js:2
m.fn.m.each   @   jquery-1.11.3.min.js:2
$.fn.validatebox.methods.validate   @   VM24260:6554
$.fn.validatebox   @   VM24260:6529
(anonymous function)   @   VM24260:6384
Stack:

My dialog onClose handler:
Code:
onClose: function () {
            app.current_dialog = false;
            app.keypress.activate();

            $(this).find('FORM').form('clear');
            window.localOnFormLoad = undefined;

            $(this).dialog('destroy');
},

Help me, please.


Title: Re: Get error when close dialog
Post by: stworthy on July 01, 2016, 10:49:28 PM
Please try to use a jQuery 1.9.x or higher version.


Title: Re: Get error when close dialog
Post by: y.bykov on July 02, 2016, 03:24:09 AM
I use jquery 1.11.3.min.js like in Demo example.


Title: Re: Get error when close dialog
Post by: y.bykov on July 02, 2016, 03:50:56 AM
Maybe it is important. I don`t submit my form, I just take form values and send separate ajax post-request.


Title: Re: Get error when close dialog
Post by: stworthy on July 02, 2016, 07:03:01 AM
If you want to destroy the dialog, you don't need to call the form's 'clear' method.
Code:
onClose: function () {
            app.current_dialog = false;
            app.keypress.activate();

            //$(this).find('FORM').form('clear');
            window.localOnFormLoad = undefined;

            $(this).dialog('destroy');
},

If your issue continues, please try to download the patch from http://www.jeasyui.com/download/downloads/jquery-easyui-1.4.5-patch.zip.


Title: Re: Get error when close dialog
Post by: y.bykov on July 02, 2016, 07:59:53 AM
Yes! It`s work!
Thank you!

This patch solve one more problem with artefact elements (for combobox) that appear after recreate few times form dialog.