Show specific value+db to the client and just db value on edit form

Show specific value+db to the client and just db value on edit form

SarbastSarbast Posts: 85Questions: 0Answers: 0
edited January 2021 in Editor

Hello,
I would like to show specific value rather than a db value to the client and db value on edit form.
How to do it?

here my code:

Editor::inst( $db, 'permissions' )
    ->fields(
        Field::inst( 'name' )
            ->validator( 'Validate::unique' ),
        Field::inst( 'icon' )
            ->getFormatter( function ( $val, $data, $opts ) {
               return '<i class="fas '.$val.' nav-icon">';                  
               } )
    )
    ->process( $_POST )
    ->json();

Note: Above code work fine and show a db value with extra text, but I need your help to show just db value on edit form.

Thanks in advance

Edited by Colin - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

Replies

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    The best way would be to just return the DB value in that PHP code you posted (i.e. no getFormatter), and add that formatting in with columns.render on the client. The fourth example on the columns.render page should get you going,

    Colin

  • SarbastSarbast Posts: 85Questions: 0Answers: 0

    Thanks Alot colin
    perfect

This discussion has been closed.