Editor throwing error - A system error has occurred

Editor throwing error - A system error has occurred

Shivani VyasShivani Vyas Posts: 113Questions: 11Answers: 0

Hello,

I am trying to submit data using editor which is throwing generic error - A system error has occurred. I already followed instruction on the page and also check Json response, everything is correct. Even when I click update button in editor window.. its updating data as well, but editor window stayed open with the error - 'A system error has occurred'.

My Editor

// Reserved Editor
var editorRES = new $.fn.dataTable.Editor( {
    ajax: "../ajax/at/lrvCheckout1.php",
    table: "#assyntCx_Table",
    fields: [
        {
            label: 'Reserved to:',
            name: 'Reserved',
            type: 'select',
            placeholderDisabled: false,
            placeholder: "Choose Reserved Entity",
       },
       {
            label: 'Reserved Start',
            name: 'ResStart',
            type: 'hidden',

       },

    ]


} );   

editorRES.on('submitComplete', function (e, json, data, action)
{
    $('#assyntCx_Table').DataTable().ajax.reload(null, false);

});

Server side is OFF too. Not sure why its causing this issue.

<?php
//SESSION START
if(!isset($_SESSION)) { 
    session_start(); 
  }

if(isset($_SESSION['userID'])) {
    $userID = $_SESSION['userID'];

} else {
    $userID = null;

} 



include("../lib/DataTables.php");

use
    DataTables\Editor,
    DataTables\Editor\Field,
    DataTables\Editor\Format,
    DataTables\Editor\Mjoin,
    DataTables\Editor\Options,
    DataTables\Editor\Upload,
    DataTables\Editor\Validate,
    DataTables\Editor\ValidateOptions;

//$update = 'd M Y';

Editor::inst( $db, 'lrv_list L')
    ->fields(

        Field::inst( 'L.id', 'id' ),

        Field::inst( 'L.reserved_entity', 'Reserved' )
            ->options( Options::inst()
                ->table('lrv_reserved_entity')
                ->value('id')
                ->label('entityName')
                ->order('id')
            )
        ->validator( Validate::notEmpty( ValidateOptions::inst()
                ->message( 'Which entity is Reserving this LRV?' )
        ) ),

        Field::inst( 'E1.entityName', 'ResEntity'),

        Field::inst( 'L.reserved_start', 'ResStart'),

        Field::inst( 'L.reserved_end', 'ResEnd')
        ->setFormatter( Format::ifEmpty( null ) ),



    )
    ->on('preEdit', function ($editor, $id, &$values) {


        if(($values['Reserved'] > 0))
        {

            $editor
                ->field('ResStart')
                ->setValue(date("Y-m-d H:i:s"));
        }


    }) 


->leftJoin( 'lrv_reserved_entity E1', 'E1.id', '=', 'L.reserve
->debug(true)
->process( $_POST )
->json();



?>

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    Answer ✓

    It means that the response from the server is not valid JSON. Try clicking the "Response" tab in your network inspector. It might show what the error is. Sometimes the JSON parser for the "Preview" can strip out error messages that are not JSON if most of the response is JSON.

    Allan

Sign In or Register to comment.