get parent of error – which control has the error? which controls have valid data submitted?

2 years ago

Member | 30

To save a draft, I have a submit button that bypasses client side validation (->setValidationScope([])) and I'm calling $form->validate(); backend. So now i want to know which submitted data is valid and which is not, so I can store the valid data only.

but when i use $form->getErrors; i get an array of error strings but not which control the error relates to. and when I use '$form->getValues();` i get both valid and invalid entries.

all i can think to do is something like this

$controls =  $form->getControls( ) ;
foreach($controls as $control){
        $controls_to_save[] = $control->name;

are there any more direct methods for accessing only validated controls backend?