Form validation

Form validation

JBergeronJBergeron Posts: 2Questions: 1Answers: 0

Description of problem:
I want to validate my form input before sending it.

I think this is what I need:

But, I don't really want to pay when I know this is the only option from the editor I would need.

Is there an alternative from preSubmit?

I could do the validation in my php back-end, but I don't understand how I can display the error with datatable.

    const dt = $(table).DataTable({
        ajax: {
            dataSrc: ''

        buttons: {
            buttons: [
                { extend: 'create', action: (e, dt) => dt.createRow(urls.create, options.create) },
                { extend: 'edit', action: (e, dt) => dt.editRow(urls.edit, { selected: true }, options.edit) },
                { extend: 'delete', action: (e, dt) => dt.deleteRow(urls.delete, { selected: true }) }

            dom: {
                button: { className: 'btn btn-dark' },

        columns: [
            { data: 'xxx' },
            { data: 'xxx' },
            { data: 'xxx' },
            { data: 'xxx' },
            { data: 'xxx' },
            { data: 'xxx'},

        dom: '<"d-flex"<"ml-auto"B>>t',
        fixedHeader: false,
        info: false,
        initComplete: () => { },
        searching: false,
        select: true

This question has an accepted answers - jump to answer


  • kthorngrenkthorngren Posts: 19,479Questions: 26Answers: 4,615
    edited July 2022 Answer ✓

    Datatables simply displays the table and provides paging, sorting and searching capabilities. It wouldn't be involved with your custom forms and does not have anything like the Editor's preSubmit. Your form would send an ajax request and if there is a server side validation error you would look for and handle it in the ajax's success function.


  • JBergeronJBergeron Posts: 2Questions: 1Answers: 0

    Ok, that's what I have done.

    Thank you :)

Sign In or Register to comment.