Edit form shows a message "An error has occurred - Please contact the system administrator"
Edit form shows a message "An error has occurred - Please contact the system administrator"
Hi. I'm trying to make the datatable work.
The problem occurs on the Edit form when I click "Update" button:
- The Edit form doesn't close but instead shows an error message "An error has occurred - Please contact the system administrator".
- The datatable doesn't refresh.
- The record in DB is updated.
I checked the javascript console with IE and Chrome but no message... How could I know what causes this error message???
Test page:
http://beta.bizrebirth.com/marketing/campaign/index-test.html
(Please scroll to the right end and click on the "Edit" link in the datatable.)
PHP script:
[code]
include( "lib/DataTables.php" );
use
DataTables\Editor,
DataTables\Editor\Field,
DataTables\Editor\Format,
DataTables\Editor\Join,
DataTables\Editor\Validate;
Editor::inst( $db, 'campaigns' )
->fields(
Field::inst( 'category_id' ),
Field::inst( 'name' ),
Field::inst( 'from_date' ),
Field::inst( 'to_date' ),
Field::inst( 'target_lead' ),
Field::inst( 'acquisition_lead' ),
Field::inst( 'budget' ),
Field::inst( 'cost' ),
Field::inst( 'remarks' )
)
->join(
Join::inst( 'mst_campaign_categories', 'object' )
->join( 'category_id', 'id' )
->fields(
Field::inst( 'name' )->name( 'category_name' )
)
)
->process( $_POST )
->json();
[/code]
The problem occurs on the Edit form when I click "Update" button:
- The Edit form doesn't close but instead shows an error message "An error has occurred - Please contact the system administrator".
- The datatable doesn't refresh.
- The record in DB is updated.
I checked the javascript console with IE and Chrome but no message... How could I know what causes this error message???
Test page:
http://beta.bizrebirth.com/marketing/campaign/index-test.html
(Please scroll to the right end and click on the "Edit" link in the datatable.)
PHP script:
[code]
include( "lib/DataTables.php" );
use
DataTables\Editor,
DataTables\Editor\Field,
DataTables\Editor\Format,
DataTables\Editor\Join,
DataTables\Editor\Validate;
Editor::inst( $db, 'campaigns' )
->fields(
Field::inst( 'category_id' ),
Field::inst( 'name' ),
Field::inst( 'from_date' ),
Field::inst( 'to_date' ),
Field::inst( 'target_lead' ),
Field::inst( 'acquisition_lead' ),
Field::inst( 'budget' ),
Field::inst( 'cost' ),
Field::inst( 'remarks' )
)
->join(
Join::inst( 'mst_campaign_categories', 'object' )
->join( 'category_id', 'id' )
->fields(
Field::inst( 'name' )->name( 'category_name' )
)
)
->process( $_POST )
->json();
[/code]
This discussion has been closed.
Replies
[quote]
Notice: Undefined index: mst_campaign_categories in /var/www/html/br/php/lib/Editor/Join.php on line 496
{"id":"row_1","error":"","fieldErrors":[],"data":[],"row":{"DT_RowId":"row_1","category_id":"2","name":"test122345","from_date":"2013-08-30","to_date":"2013-08-31","target_lead":"100","acquisition_lead":"10","budget":"100","cost":"0","remarks":"test","mst_campaign_categories":{"category_name":"\u30e1\u30c7\u30a3\u30a2"}}}
[/quote]
It seems like it's trying to update the joined table as well although it isn't expected to be updated? By commenting out the line 496, it works fine, but I think there must be a way to avoid commenting out this line as I believe it would cause another problem.
Are you using the standard Editor PHP libraries?
Also, could you confirm for me which DataTables account you used to purchase Editor so I can assign the license correctly please?
Thanks,
Allan
->join( 'category_id', 'id' )
->table( 'mst_campaign_categories' )
->set( false )
Now it works without modifying the Join class. Thanks!
I kind of think it should be false by default...wondering how often multiple tables need to be updated.
Could you confirm for me which DataTables account you used to purchase Editor so I can assign the license correctly please? Please feel free to PM me if you'd rather that way rather than in the public forum.
Allan
Allan