Giter Club home page Giter Club logo

Comments (6)

GoogleCodeExporter avatar GoogleCodeExporter commented on July 22, 2024
I fixed this by modifying the _fnOnCancelRowAdding(event) function to the 
following:

        //Called when user cancels adding new record in the popup dialog
function _fnOnCancelRowAdding(event) {
    //Close the dialog
    oAddNewRowForm.dialog('close');
    $(oAddNewRowForm).validate().resetForm();      <---- This is the line I added
    $(oAddNewRowForm)[0].reset();
    $(".error", $(oAddNewRowForm)).html("");
    event.stopPropagation();
    event.preventDefault();
}

Original comment by [email protected] on 7 Jun 2011 at 7:14

from jquery-datatables-editable.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 22, 2024
Also, if the user has the error messages displayed in a div with class "error", 
it won't be cleared properly if the form is closed after a validation error. 
The changes below fix that:

//Called when user cancels adding new record in the popup dialog
function _fnOnCancelRowAdding(event) {
//Close the dialog
   oAddNewRowForm.dialog('close');
   $(oAddNewRowForm).validate().resetForm();  // Clears the validation errors
   $(oAddNewRowForm)[0].reset();
   $("div.error span", $(oAddNewRowForm)).html("");
   $("div.error", $(oAddNewRowForm)).hide();  // Hides the error div
   event.stopPropagation();
   event.preventDefault();
}

Original comment by [email protected] on 8 Jun 2011 at 11:20

from jquery-datatables-editable.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 22, 2024
Hi,

I have not noticed this issue. I all my examples on the site, when error is 
shown following code clear the form and error labels:
    $(oAddNewRowForm)[0].reset();
    $(".error", $(oAddNewRowForm)).html("");
Only potential issue is that when user closes the form (e.g. click on the [x] 
button in the upper right corner), form/messages are not cleared (to enable 
user to continue with editing if he accidentelly closed the dialog).

However I have added your code because it does nto collide with the current 
code. The only change is that I have not included div in the selector because  
would not link to put any constraint such as "you must wrap error labels in the 
div tags".
Current code is:

        //Called when user cancels adding new record in the popup dialog
        function _fnOnCancelRowAdding(event) {
            //Clear the validation messages and reset form
            $(oAddNewRowForm).validate().resetForm();  // Clears the validation errors
            $(oAddNewRowForm)[0].reset();

            $(".error", $(oAddNewRowForm)).html("");
            $(".error", $(oAddNewRowForm)).hide();  // Hides the error element

            //Close the dialog
            oAddNewRowForm.dialog('close');
            event.stopPropagation();
            event.preventDefault();
        }

Could you please take the latest version and let me know whether it wrks in 
your example?

Thanks,
Jovan


Original comment by [email protected] on 11 Jun 2011 at 8:33

  • Changed state: Accepted

from jquery-datatables-editable.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 22, 2024
This works. I have to include the div/span due to implementation details of my 
application.

Original comment by [email protected] on 11 Jun 2011 at 11:06

from jquery-datatables-editable.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 22, 2024
Ok,I'm closing this issue.

Original comment by [email protected] on 11 Jun 2011 at 3:24

  • Changed state: Fixed

from jquery-datatables-editable.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 22, 2024
Just a note regarding this error: $(oAddNewRowForm)[0].reset is not a function

If you happen to have a form reset button with id="reset", this will cause this 
issue to occurr also.

Just a note to assist others.

Original comment by [email protected] on 13 Oct 2011 at 7:12

from jquery-datatables-editable.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.