Notice: Array to string conversion for check boxes
Notice: Array to string conversion for check boxes
agustin_garciaromero
Posts: 42Questions: 0Answers: 0
Hello,
In Editor 1.2.1, I have a checkbox with options as shown below, where I'm getting an error like:
"
...
Notice: Array to string conversion \DTEditor.mysql.pdo.class.php on line 507
{"id":"inc_2","error":"","fieldErrors":[],"data":{...,"automatic_tracking":"Array" ...}}
...
"
This happen when I click on Edit, select that checkbox in the form and click the Update button, I receive an error message like "An error has ocurred - Please contact the system Administrator-
If I cancel the operation by clicking on [quote]X[/quote] and refresh the DataTables page, that column shows up now with the value of "Array"
When querying the database, its value shows up as "Array" as well.
I click on Edit again, the checkbox shows up un-checked, if I click on Update -without touching that checkbox-, the record is properly saved and that columns displays as empty on the DataTables page.
[code]
...
{
"label": "Automatic Tracking",
"name": "automatic_tracking",
"type": "checkbox",
"ipOpts": [
{
"label": "",
"value": "Y"
}
]
},
...
[/code]
Any hint here?
In Editor 1.2.1, I have a checkbox with options as shown below, where I'm getting an error like:
"
...
Notice: Array to string conversion \DTEditor.mysql.pdo.class.php on line 507
{"id":"inc_2","error":"","fieldErrors":[],"data":{...,"automatic_tracking":"Array" ...}}
...
"
This happen when I click on Edit, select that checkbox in the form and click the Update button, I receive an error message like "An error has ocurred - Please contact the system Administrator-
If I cancel the operation by clicking on [quote]X[/quote] and refresh the DataTables page, that column shows up now with the value of "Array"
When querying the database, its value shows up as "Array" as well.
I click on Edit again, the checkbox shows up un-checked, if I click on Update -without touching that checkbox-, the record is properly saved and that columns displays as empty on the DataTables page.
[code]
...
{
"label": "Automatic Tracking",
"name": "automatic_tracking",
"type": "checkbox",
"ipOpts": [
{
"label": "",
"value": "Y"
}
]
},
...
[/code]
Any hint here?
This discussion has been closed.
Replies
Any update on this one?
I did create a fresh DataTable form with Editor and installed in a fresh folder, but its giving me the same type of error on the HTML response object when I click on Update:
Notice: Undefined property: DataTables\Editor\Field::$name in /home/royalela/public_html/DataTables/php/lib/Editor/Editor.php on line 319
{"id":-1,"error":"","fieldErrors":[{"name":null,"status":null},{"name":null,"status":null},{"name":null,"status":null}],"data":[]}
You can try it at: http://royalelandscaping.com/DataTables/inc_gross_income.html
Allan
The code is shown below, PHPVersion: 5.4
The RESPONSE error now looks like:
"
Warning: PDO::__construct(): The server requested authentication method unknown to the client [mysql_old_password] in /home/royalela/public_html/DataTables/php/lib/Database/Driver/Mysql/Query.php on line 51
{"sError":"An error occurred while connecting to the database 'royalela_pfm'. The error reported by the server was: SQLSTATE[HY000] [2054] The server requested authentication method umknown to the client"}
"
[code]
<?php
/*
* Editor server script for DB table inc_gross_income
* Automatically generated by http://editor.datatables.net/generator
*/
// DataTables PHP library
include( "lib/DataTables.php" );
// Alias Editor classes so they are easy to use
use
DataTables\Editor,
DataTables\Editor\Field,
DataTables\Editor\Format,
DataTables\Editor\Join,
DataTables\Editor\Validate;
// Build our Editor instance and process the data coming from _POST
Editor::inst( $db, 'inc_gross_income' )
->fields(
Field::inst( 'master_id' )
->validator( 'Validate::email_required' ),
Field::inst( 'user_id' )
->validator( 'Validate::email_required' ),
Field::inst( 'payer' )
->validator( 'Validate::required' ),
Field::inst( 'Recipient' )
->validator( 'Validate::required' ),
Field::inst( 'category' )
->validator( 'Validate::required' ),
Field::inst( 'payment_amount' )
->validator( 'Validate::required' ),
Field::inst( 'estimated' ),
Field::inst( 'periodicity' )
->validator( 'Validate::required' ),
Field::inst( 'payment_date' )
->validator( 'Validate::dateFormat_required', 'D, j M y' )
->getFormatter( 'Format::date_sql_to_format', 'D, j M y' )
->setFormatter( 'Format::date_format_to_sql', 'D, j M y' ),
Field::inst( 'automatic_tracking' ),
Field::inst( 'linked_account' )
->validator( 'Validate::required' ),
Field::inst( 'bill_reminder' )
->validator( 'Validate::dateFormat', 'D, j M y' )
->getFormatter( 'Format::date_sql_to_format', 'D, j M y' )
->setFormatter( 'Format::date_format_to_sql', 'D, j M y' ),
Field::inst( 'income_type' )
->validator( 'Validate::required' ),
Field::inst( 'memo' )
)
->process( $_POST )
->json();
[/code]
Allan
I confirmed with host provider (SiteGround), they recognize it has to do with their setup:
"
...Our MySQL servers are configured to use the --old-passwords option. This is mandatory because the cPanel interface generates such passwords. Unfortunately, PHP 5.4 does not support old MySQL passwords.
This is a common problem and many people have experienced it.
I can offer you the following two solutions:
1. I can configure the scripts in this folder to use PHP 5.3 or PHP 5.2.
2. I can manually edit the global mysql database on the server and I change the password string for your MySQL user. However, this means that you will not be able to manage the same user from the cPanel interface.
RELATED WITH:
The server requested authentication method unknown to the client [mysql_old_password]" "An error occurred while connecting to the database 'royalela_pfm'. The error reported by the server was: SQLSTATE[HY000] [2054] The server requested authentication method umknown to the client"}"
"
Not sure if this can help other people
Host provider addressed the PHP5.4 & MySQL compatibility issue, but now that it's being fixed, it takes me to the issue I reported in a separate item:
This is after I've entered all the required data for a new record and then hit on the Create button.
"
An error has occurred - Please contact the system administrator
Notice: Undefined property: DataTables\Editor\Field::$name in /home/royalela/public_html/DataTables/php/lib/Editor/Editor.php on line 319
"
It leaves me unable to Create/Update records through Editor
Any idea here?
Which version of the DataTables PHP classes are you using? The Editor.php version is almost certainly 1.2.1 from the error, but did you also update Field.php?
Also, what is being sent to the server by Ajax?
And finally, this stands out for me:
> Field::inst( 'Recipient' )
Its the only uppercase field name you've got. Is that intentional?
Allan
I didn't change any file on the "out of the box" Editor files, in fact the js, sql and php files related with my Datatable object were untouched as well.
I said "were", because I just modified them all to change "Recipient" to "recipient" (I even renamed the Database field), but the issue remains the same:
"
Notice: Undefined property: DataTables\Editor\Field::$name in /home/royalela/public_html/DataTables/php/lib/Editor/Editor.php on line 319
{"id":-1,"error":"","fieldErrors":[{"name":null,"status":null},{"name":null,"status":null},{"name":null,"status":null}],"data":[]}
"
I tried with both FF and Chrome, with the same results
POST looks like:
action:create
table:
id:
data[master_id]:oiu
data[user_id]:oiu
data[payer]:oiu
data[recipient]:A
data[category]:a
data[payment_amount]:oui
data[estimated][]:Y
data[periodicity]:A
data[payment_date]:Wed, 17 Oct 12
data[automatic_tracking][]:Y
data[linked_account]:A
data[bill_reminder]:Tue, 2 Oct 12
data[income_type]:A
data[memo]:iouio
Allan
This can be closed as the 1.2.2 version fixed what I was addressing.
thanks for the support