PsKs / jquery-datatables-editable

Automatically exported from code.google.com/p/jquery-datatables-editable
0 stars 0 forks source link

Add form reset() method breaks on cancel in IE and FireFx #29

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi, 
after a problem, adding a comment on the following lines let me close the 
dialog popup window:

         //Called when user cancels adding new record in the popup dialog
        function _fnOnCancelRowAdding(event) {
            //Close the dialog
            oAddNewRowForm.dialog('close');
//            $(oAddNewRowForm)[0].reset();
            $(".error", $(oAddNewRowForm)).html("");
            event.stopPropagation();
            event.preventDefault();
        }
if not, IE and FireFox issue an error (inexistent method on the object).

is that a bad work around , what is the purpous of this code ? 
thanks and sorry for noise 

Original issue reported on code.google.com by philippe...@gmail.com on 8 Jun 2011 at 5:58

GoogleCodeExporter commented 9 years ago
This code is used to reset form fields once the user press cancel button (so 
blank form can be shown next time he opens add dialog). I have tried it in 
several browsers and it worked fine. Without this line if you populate fields, 
press cancel, and add button again you will see all fields you entered in the 
previous dialog.

Issue you have reported is strange because reset() is a standard function for 
reseting forms. Could you see in the firebug is the $(oAddNewRowForm)[0] 
standard form element? In all my examples it is a frm and therefore it works 
fine.

Could you try to take the latest version of plugin I have slightly changed this 
code (reseting form is moved before dialog close maybe this is problem in your 
browser).

Regards,
Jovan

Original comment by joc...@gmail.com on 11 Jun 2011 at 8:57

GoogleCodeExporter commented 9 years ago
Hi,

I'm sorry, I made a error using a 'div' instead of a 'form' as sAddNewRowFormId 
dom element. I think this is the cause of the problem. 

Perhaps a control could be done to avoid this kind of misuse ? 

Thanks for your answer.

Original comment by philippe...@gmail.com on 11 Jun 2011 at 2:16

GoogleCodeExporter commented 9 years ago
I'm not sure about this check because I'm trying to put minimal number of 
constraints related to the HTML structure.
In the future maybe form will be required tag but maybe it will not be required 
at all I have still not choosen the road map for this.
Currenly I'm assuming that stucture is created according to the examples/wiki 
pages.

Regards,
Jovan

Original comment by joc...@gmail.com on 11 Jun 2011 at 7:20

GoogleCodeExporter commented 9 years ago

Original comment by joc...@gmail.com on 17 Jun 2011 at 7:35