Closed hrvojebrkasic closed 6 years ago
You don't need to wirte your own HTML. You can use Symfony form for that. I would write a new action, read the data from the database into the Symfony form and render this. Then make your changes and store this as a new item. I think you must create a own Symfony form type because the easyadmin form builder is not flexible enough.
I agree with @fadoe: for this kind of heavy customizations, it's better to rely directly on Symfony Form features. I'm sorry I can't be of more help.
Thanks both of you. I have implemented (almost the same day) that way (using Symfony Forms) and instead of using ajax, I used simple page reload on changed value in select to fill form with desired data. Sorry for not providing any feedback earlier and thanks for help once again.
I know this is an old issue, @hrvojebrkasic could you maybe provide an example if you still have it ? Im currently facing the same issue, where I need to show a prefilled form (Form is already existing in a CRUD controller) but I want to prefill it via an custom action.
I have a list of 30 employees in database. Every employee has it's monthly salary which has some constant values and some values may vary regarding of month (let's say number of working days or anything else, doesn't matter) What I have to do is create new action, prefill, whose job should be prefilling form with data from last salary for user linked with that salary (it's time consuming job to enter every value every time). Since I have 30 employees, in current state on edit action, employees are dropdown, so prefill should implement ajax call on that dropdown so I don't have to care about salary I clicked (and therefore user linked with that salary) and I can just pick employee from dropdown, ajax returns last salary for picked employee, I change what has to be changed and on save it creates NEW salary object.
What would be the best way to do that? I have created custom action on list view but creating form is bugging me.
from composer.lock: