Uncaught Error: Call to a member function dbField()

Uncaught Error: Call to a member function dbField()

bbrindzabbrindza Posts: 329Questions: 78Answers: 1
edited February 27 in Editor

Hello,

Getting this error.. any thoughts .

<b>Fatal error</b>:  Uncaught Error: Call to a member function dbField() on array in /www/seidenphp/htdocs/DataTables_Editor/lib/Editor.php:1107
Stack trace:
#0 /www/seidenphp/htdocs/DataTables_Editor/lib/Editor.php(1003): DataTables\Editor-&gt;_get()
#1 /www/seidenphp/htdocs/DataTables_Editor/lib/Editor.php(707): DataTables\Editor-&gt;_process()
#2 /www/seidenphp/htdocs/MIS/GlobalNetTabManagement/ssp_GlobalNetTabManagement.php(47): DataTables\Editor-&gt;process()
#3 {main}
  thrown in <b>/www/seidenphp/htdocs/DataTables_Editor/lib/Editor.php</b> on line <b>1107</b><br />
 Field::inst( 'NAV_ACTIVE' )
               ->validator(Validate::in(['Y', 'N'], ValidateOptions::inst()
                          ->message('The value must be Y or N')
                       )) 

Answers

  • allanallan Posts: 64,059Questions: 1Answers: 10,559 Site admin

    What version of the PHP libraries are you using please? I check the 2.3.2 code, as you mentioned that version in a recent post, but it doesn't correspond with an error like that. Likewise with the latest release.

    Can you post the full PHP Editor init as well please? What makes you think it is the NAV_ACTIVE field that is causing the issue? Does the error go away if you remove it?

    Allan

  • bbrindzabbrindza Posts: 329Questions: 78Answers: 1

    Hi Allan,

    Yes Editor 2.3.2. Here is the entire script.

    <?php
    session_start();
    date_default_timezone_set('America/Chicago'); // CDT
    
    // DataTables PHP library
    require( $_SERVER['DOCUMENT_ROOT']."/DataTables_Editor/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, 'BOBBRI.NAVS', 'NAV_ID')
      ->fields(
    
          Field::inst('NAV_ID') 
              ->validator( Validate::notEmpty( ValidateOptions::inst()
                  ->message( 'Please enter a value using a decimal for tab level, ie.1.1, 1.2, 1.2.2 ' )
                  ) ), 
          
         Field::inst( 'NAV_DESCRIPTION' )
                ->getFormatter( 'Format::Trim' )
                ->setFormatter( 'Format::Trim' )
                ->xss(false), //will prevent column value with & for write to DB2 as &amp;
          
         Field::inst( 'NAV_SCRIPT_NAME' )
                ->getFormatter( 'Format::Trim' )
                ->setFormatter( 'Format::Trim' )
                ->xss(false),
          
         Field::inst( 'NAV_ACTIVE' )
                   ->validator(Validate::in(['Y', 'N'], ValidateOptions::inst()
                              ->message('The value must be Y or N')
                           )) 
      )
        
    //->debug(true)
    ->process( $_POST )
    ->json();
    
    
  • allanallan Posts: 64,059Questions: 1Answers: 10,559 Site admin

    Ah I was wrong, sorry. The 2.3.2 file does correspond with that error on that line. I must have looked at something else by mistake.

    However, the Error message suggests that there is no field found, which doesn't make sense with the code above.

    Is that the full unmodified file?

    Allan

Sign In or Register to comment.