Errors on updating and creating
Errors on updating and creating
I am unable to update or create from editor. I am using a postgres database.
For updating, the error returned is :
<b>Notice</b>: Undefined index: id in <b>/php/lib/Editor/Editor.php on line 501
My id field is not "id", but I have set the correct name in the idSrc, as well as in the Editor::inst parameter.
The create error is the following:
Call to a member function insertId() on a non-object in /php/lib/Editor/Editor.php</b> on line <b>1109
The post parameters look correct.
If it is significant, I have a join in my server-side php to get a related table for a select field options. I also have a where so that the datatable is filtered.
This question has an accepted answers - jump to answer
Answers
Hi,
Have you configured the PHP
Editor
instance to tell it what the primary key column name is? You can do so by passing a string (the column name) as the third parameter to theEditor
constructor.Allan
Allan,
Yes, I have done that. I have a join table, so I have tried with the tablename.columnname and just columnname in the third parameter. Same result on both errors. On the edit, it pulls up the record correctly, but I assume that is just grabbing it from the datatable.
If you use the third parameter in the
Editor
constructor you should need to setidSrc
- Editor will see it automatically.Can you show me your full PHP please.
Allan
Here you go.
As I mentioned, I've tried with both just history_id as well as case_history.history_id. I've included it as a field as well as left it out.
Thanks so much
Hi,
Thanks for the code!
Try removing:
and also remove the
idSrc
option in your Javascript. As I say, since you have used the third parameter in theEditor
PHP constructor, it isn't needed.Allan
Allan,
I have removed the field inst for the id field as you suggested, as well as the idSrc. Same error. The line causing the error (at least on the editing piece) in Editor.php is:
$this->_update( $data['id'] );
Here is a var_dump of the data array right before the error:
Are you using the same version of the PHP libraries as the Javascript (ideally both 1.5.4 - the current release)? And have you not got the
legacyAjax
option set in your Editor configuration?Allan