Comments (6)
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.
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.
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.
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.
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.
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)
- issue with inline delete redrawing with pagination, only 1st page worksrest ( including searches ) do not redraw table
- Not compatible with jquery higher than 1.9
- Add new row: after first insert, the Cancel button not shown
- Error on Deleted Row
- Only first page of mult-page table is editable. HOT 1
- Delete Button problem HOT 2
- makeEditable() is undefined HOT 1
- Unable to customize buttons HOT 1
- How I can make Editable more of one table
- Patch for /trunk/media/js/jquery.dataTables.editable.js
- Editing AJAX sourced data in the popup window
- Patch for /trunk/media/js/jquery.dataTables.editable.js
- Delete behaving as Post call
- Refresh the table after delete a record
- Refresh the table after delete a record HOT 1
- Missing images for demo_table.css HOT 1
- vgfdzvfz
- editable with responsive HOT 1
- makeEditable() on two tables in the same page HOT 1
- sNewCellDisplayValue is undefined. Typo in variable declaration
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jquery-datatables-editable.