Open nocelab opened 2 months ago
This is the situation by design as by changing that value the entity would drop out of the model.
See discussion here https://github.com/atk4/data/issues/1052
You need to make sure that onSubmit the model is unconditioned that is used to save the changed entity, and the conditioned model is only used to display the crud.
Agree that this it not very intuitive and good tips welcome what the best way to code it might look like
Thanks... very happy that someone has a similar situation!!! I need to deep read the post to understand better if there is my answer... but it's sure the right way.
I also tried to modified demos/crud.php
adding:
$model->addCondition($model->fieldName()->name, 'like', "I%");
saving one edited row (changing the Name with something not starting with "I") works good without error... but looking source code I don't realize why
I need to set a Crud with a records subset.
The Model has the combo field:
$this->addField('tipo', ['values' => ['x' => 'fix', '+' => 'new', '-' => 'removed']]);
and I add condition with:
$mod->addCondition($mod->expr("tipo = '+'"));
Crud show correctly the recordset but when I try to edit a row, changing
tipo
value, I get this error on saving: