multi-edition with preedit events

multi-edition with preedit events

halexx2018halexx2018 Posts: 1Questions: 1Answers: 0
->on( 'preEdit', function($editor, $id, &$values ){ 
        $numero_documento = explode("-", $values['controle_avanco']['numero_documento']);
        $editor     
            ->field( 'controle_avanco.numero_documento' )
            ->setValue($numero_documento[0]."-".$values['controle_avanco']['disciplina'].$values['controle_avanco']['tipo_documento']."-".$numero_documento[2]);
    } ) 

I make a composition of fields before saving to the database, it works for single editions, but when I edit many fields, the field 'controle_avanco.numero_documento' is the same in all

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin

    preEdit is run for all rows before any of them are processed (the idea being that any one can be used to fail validation and thus all should be rejected in case it results in invalid data).

    Your best option here is to use a custom set formatter function since you are just trying to modify the value of an individual field.

    Regards,
    Allan

Sign In or Register to comment.