Show validation error message in cell, under value text, using inline editor
Show validation error message in cell, under value text, using inline editor
Hi,
I had a datatable (in Bootstrap 4 environment) with inline editor and everything works fine.
Now, I had to configure my datatable to execute validation in my inline editor, showing error message in the datatable, under the value of the cell.
I put this test code in presubmit event
editor.on( 'preSubmit', function ( e, o, action ) {
if (action == 'edit') {
var iniDateField = this.field( iniDate);
iniDateField.error( 'Dummy error' );
return false;
}
} );
but I dont see my custom message 'Dummy error' under the value of the cell,
How can I do this? How can I configure my datatable?
Thanks,
Davide
Answers
I see it here - http://live.datatables.net/xujohoca/1/edit - it appears when you inline edit the start date field. Could you look at that, please, and see if it helps. If it's still not working for you, please can you update my example, or link to your page, so that we can see the problem.
Cheers,
Colin
Thank you Colin,
you example work for my, but only if you confirm the date pressing enter key: when you click on another cell the error message disappear.
Furthermore, in my example I also have the datepicker in the date cell and I see the error only if I press enter key after the selected date (by datepicker) is showed in the cell.
How to can I always show the error?
Thanks,
Davide
Hi Davide,
Are you doing this validation server-side as well? If so, remove what you have there and the error message should show up as expected inside the date picker (it has a listener on the Ajax complete to look for this sort of thing). If you aren't using server-side validation, you'll need to add that anyway since client-side validation is trivial to bypass.
Allan
Hi,
i resolve the problem:
in the table creation I add this key configuration
and so this command stop to work correctly
I can not use key extension, but anybody know why is there this incompatibily?
Thanks,
Davide
Hi Davide,
I'm a little confused - sorry. Why do you have a
keys
property if you can't use KeyTable?Allan