Server Side 'preCreate' to create hidden column

Server Side 'preCreate' to create hidden column

cbasmadjiancbasmadjian Posts: 56Questions: 14Answers: 0

I am having some difficulty on hiding this information that is not meant to be sent back to the browser. Need to create a token system (private key) that I want the server to know about. But don't want this passed back to the client side. Not understanding exactly what I need to do.

Within in my Field Editor I have the following...

Field::inst( 'Table.token' )->set( Field::SET_CREATE ),

I understand that this is telling the datatables that this field is on create only type of thing.
https://editor.datatables.net/manual/php/conditions#Setting-field-values

Inside my preCreate event I am doing the following...

->on( 'preCreate', function ( $editor, $values ){
    $editor->field( 'Table.token' )->setValue( functionThatCreatesUniqueness() );
} )

This code works fine and gets me what I need. But I am clueless how to tell DataTables don't send this info to the client. It's not necessary. Only the server needs to be aware of this.

Any suggestions? Thanks!

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Answer ✓

    Use ->get( false ) if you don't want the field to be sent to the client-side.

    Allan

  • cbasmadjiancbasmadjian Posts: 56Questions: 14Answers: 0

    Thank you! That did the trick.

This discussion has been closed.