Dependant select2 with ajax #1012
-
How do I use this same structure in Backpack 6.x? I have a table of States and another of Cities and I need the city combo to depend on the state information. On Controller:
On City Api:
Return Error: Undefined array key "state_id" Could you help me with this problem or give me a cool alternative? Originally posted by @helesjunior in Laravel-Backpack/CRUD#1484 (comment) |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
That specific error could be fixed if you use in the if: if(! isset($form['state_id']) || empty($form['state_id'])) Cheers |
Beta Was this translation helpful? Give feedback.
-
Oops, I managed to solve the problem. I believe it would be good if they added this to the documentation. You need to add the parameter "'include_all_form_fields' => true" for it to work. So it ended up like this: In Field
In Fetch Fuction:
And de results: Thanks a lot. |
Beta Was this translation helpful? Give feedback.
@pxpm
Oops, I managed to solve the problem. I believe it would be good if they added this to the documentation. You need to add the parameter "'include_all_form_fields' => true" for it to work. So it ended up like this:
In Field