postEdit returns empty $row
postEdit returns empty $row
for PHP library
Editor->on( 'postCreate', function ( $editor, $id, $values, $row )
$row works just fine. However,
Editor->on( 'postEdit', function ( $editor, $id, $values, $row )
$row is always empty while $values has only the edited values. What I need is some other values in the same row that set to be read only.
thanks.
This question has an accepted answers - jump to answer
This discussion has been closed.

Answers
this was tricky.
it turned out the reason is that I'm using both
preEditandpostEditwhere
preEditcontains$editor->field( )->setValue( );to set a value based on some logic.Still, the problem not solved yet. how can I use preEdit to set some value then work on postEdit row data?
So if you use
preEditwith thefield()->setValue()the$rowis completely empty inpostEdit!? That absolutely should not be happening!Could you show me your code please?
Thanks,
Allan
Hi Allan,
my apologies.. you're right. my analysis wasn't correct
it's all about the where condition. Once
stagehas been changed inpreEdit,postEditis useless in my case.->where( 'stage', 1, '=' )->on( 'preEdit', function ( $editor, $id, $values){ $editor->field('stage')->setValue(2);})->on( 'postEdit', function ( $editor, $id, $values, $row ){...})My alternative solution now is removing
preEditand do updatestageinpostEditusingdb()->update()methodThank you Allan
Ah!
There is also the
writeEditevent which can be used likepostEdit, but it is triggered before the libraries read data from the database, so you can modify the table's data before it is read.Allan
cannot use that;
$rowis not available forwriteEditusing
db()->update()was sufficient for me.Thank you