Question

I would like to modify the form class so for every field_reference it adds a button + so users are able to directly insert a new element into that referenced table.

i.e: I'm completing a customer form and cannot found his city in the list. I just click an the + and the city form appears and let me insert the correct city.

I think I have to try by modifying atk4/lib/Controller/MVCForm.php around

if($field instanceof Field_Reference || $field_type=='reference') { $form_field->setModel($field->getModel()); }

But maybe it's something to add in atk4/lib/field/Reference.php directly.

Was it helpful?

Solution

Try out this one: https://github.com/atk4/autocomplete/blob/master/lib/Form/Field/Plus.php

It's not exactly what you're asking for, but this field type has implemented "plus" behavior. You can at least get some ideas from there if not using autocomplete field

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top