Cannot read property 'canReturnSubmit' of null
Cannot read property 'canReturnSubmit' of null
bbrindza
Posts: 316Questions: 73Answers: 1
I am attempting to add client-side validation to my editor script and I am receiving the error below.
Not sure what I am missing .
Uncaught TypeError: Cannot read property 'canReturnSubmit' of null
at HTMLDocument.<anonymous> (dataTables.editor.min.js:78)
at HTMLDocument.dispatch (jquery-current.min.js:3)
at HTMLDocument.q.handle (jquery-current.min.js:3)
var editor;
$(document).ready(function() {
editor = new $.fn.dataTable.Editor( {
ajax: "ssp_AllergenReviewManagement.php",
table: "#allergenTable",
fields: [{label: "Location",
name: "ELOC",
type: "display",
},
{label: "Formula",
name: "EFORM",
type: "display",
},
{label: "Formula Description",
name: "EDESC",
type: "display",
},
{label: "Pack Size",
name: "EPACK",
type: "display",
},
{label: "Developed For",
name: "EDEV",
type: "display",
},
{label: "Exclusive",
name: "EEXC",
type: "display",
},
{label: "Proprietary",
name: "EPRO",
type: "display",
},
{label: "Total",
name: "ETOTEG",
type: "display",
},
{label: "Quantity",
name: "ETOTQY",
type: "display",
},
{label: "Percent",
name: "EPERCT",
type: "display",
},
{label: "Allergen",
name: "EALGRN",
type: "display",
},
{label: "Reviewed",
name: "ELOOKO",
attr: {maxlength:1,
style: "height:20px; width:20px",}
},
{label: "Reviewed By",
name: "EUSER",
type: "display",
},
{label: "Reviewed On",
name: "EDATE",
type: "display",
},
]
} );
$('#allergenTable').on( 'click', 'tbody td:not(:first-child)', function (e) {
editor.inline( this,{onBlur:"submit"} );
} );
editor.on( 'preSubmit', function ( e, o ) {
if ( o.data.ELOOKO === '' ) {
this.error('ELOOKO', 'Review Flag Can Not Be Blank');
return false;
}
else if ( o.data.ELOOKO !== 'Y' ) {
this.error('ELOOKO', 'Review Flag Must Be Y or N');
return false;
}
} );
$('#allergenTable').DataTable( {
dom: "Bfrtip",
ajax: "ssp_AllergenReviewManagement.php",
order: [[ 1, 'asc' ]],
iDisplayLength: "15",
columns: [
{
data: null,
defaultContent: '',
className: 'select-checkbox',
orderable: false
},
{ data: "ELOC" },
{ data: "EFORM" },
{ data: "EDESC" },
{ data: "EPACK" },
{ data: "EDEV" },
{ data: "EEXC" },
{ data: "EPRO" },
{ data: "ETOTEG" },
{ data: "ETOTQY" },
{ data: "EPERCT" },
{ data: "EALGRN" },
{ data: "ELOOKO" },
{ data: "EUSER" },
{ data: "EDATE" }
],
select: {
style: 'os',
selector: 'td:first-child'
},
buttons: [
// { extend: "create", editor: editor },
// { extend: "edit", editor: editor },
// { extend: "remove", editor: editor }
]
} );
} );
This question has accepted answers - jump to:
This discussion has been closed.
Answers
There are a couple of threads that mention this error is a bug in Editor 1.6.1. What version are you running?
Kevin
1.6.1
According to those threads the issue is fixed in 1.6.2. The Editor is at 1.6.5 now. I would try upgrading to see if it resolves the issue. You can search the forum for your error message to find the other threads if interested.
Kevin
I will try that