ReferenceError: Can't find variable: Editor

ReferenceError: Can't find variable: Editor

sharpspoonsharpspoon Posts: 6Questions: 2Answers: 0
edited September 2022 in Editor

Hello,

I am receiving the following error when loading my Editor table. I am using the newest PHP DataTable version.

I am using:
Python Flask,
Editor-PHP-2.0.10,
Bootstrap5

This question has an accepted answers - jump to answer

Answers

  • sharpspoonsharpspoon Posts: 6Questions: 2Answers: 0

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

    Hi,

    That error will happen with Editor 2.0.9 but it should have been fixed with Editor 2.0.10 (like in this example).

    You could use this copy of the editor.bootstrap5.js file which should work unless there is something else going wrong. If that doesn't fix it, can you give me a link to your page please?

    Thanks,
    Allan

  • sharpspoonsharpspoon Posts: 6Questions: 2Answers: 0
    edited September 2022

    Hi, that new version seemed to have fixed the issue.

    Now when I edit my record, no changes are saved to the database.
    The connection to the db is successful, because the table populates with the database data.
    However, when I create a new record, whatever I type will return to the table with an existing value. After the page is refreshed, the original data is returned.

    Here is my php file

    <?php
    
    /*
     * Editor server script for DB table location
     * Created by http://editor.datatables.net/generator
     */
    
    // DataTables PHP library and database connection
    include( "Editor-PHP/lib/DataTables.php" );
    
    // Alias Editor classes so they are easy to use
    use
        DataTables\Editor,
        DataTables\Editor\Field,
        DataTables\Editor\Format,
        DataTables\Editor\Mjoin,
        DataTables\Editor\Options,
        DataTables\Editor\Upload,
        DataTables\Editor\Validate,
        DataTables\Editor\ValidateOptions;
    
    // Build our Editor instance and process the data coming from _POST
    Editor::inst( $db, 'location', 'id' )
        ->fields(
            Field::inst( 'location_name' )
        )
        ->process( $_POST )
        ->json();
    
  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    Answer ✓

    Hi,

    The PHP looks absolutely fine there. Are you able to give me a link to your page so I can debug it? You can send me a private message if you don't want to make the page url public.

    Allan

Sign In or Register to comment.