Accessing row data in preEdit in PHP
Accessing row data in preEdit in PHP
I have some values for a row that I use in my PHP file to inst them, but I purposely don't allow them to be in the editor, even if they are locked because I don't want the user to hijack the ajax request on edit and alter the value.
How can I access a value like this on preEdit? For example, it's really easy to access the data being sent from the server in the ajax call, but how can I access the data about the row that is not being sent up in the ajax call?
Example code:
Field::inst( 'tblExample.isExample' )
->set( false )
.....
->on( 'preEdit', function ( $editor, $id,$values ) {
//here is where you can pull values easily, like $example = $values['tblExample']['example'];
// but how can I pull values not in the $values variable? When I var_dump the $editor variable, I cannot see how to grab the values since they are private.
//GOAL: get tblExample.isExample value
}
This question has an accepted answers - jump to answer
Answers
You'd need to query the database to get it. The
$values
array only contains the information submitted by the client-side.You could use something like:
To get the information from the database.
Allan
Posted in error- sorry.