preEdit - How to reference field when using JOIN?
preEdit - How to reference field when using JOIN?
Hello,
Using Editor, I have a JOIN, and am trying to use preEdit. I keep getting "Undefined Index" errors on the server.
...
Field::inst( 'people.id' ),
Field::inst( 'people.role' ),
Field::inst( 'users.username' ),
Field::inst( 'users.passwd' ),
...
->on( 'preEdit', function ( $editor, $id, $values ) {
$editor
->field('users.passwd')
->setValue( sha1($values['passwd']) );
} )
Line 10 above gives me the error "Undefined index: passwd". I have tried $values['users']['passwd'], and get the same error. I also tried $values[users.password], but get "Illegal string offset 'users.password'" when I do it that way.
This discussion has been closed.
Answers
$values['users']['passwd']
should do it, but you say you've tried that already. Are you sure it is being submitted from the client-side? Can you show me the data from the browser's network inspector that is being submitted to the server please?Allan
I had checked the browser inspector and verified the field was being sent, etc. But I had missed a small detail that was the root of the problem.
The field was being sent as
$values['users']['password']
instead of passwd, because I had named it "password".Thanks for the reply.
Michael