Dependent Dropdowns: Parent-Child
In our QuickAdminPanel generator, we don't have such feature like parent-child dropdowns, for example Country-City relationship where change of Country value refreshes the values of Cities.
However, you can build it yourself quite easily - we have a blog article for you: Laravel Forms: Select Dependent Dropdowns with jQuery and AJAX​
In summary, you need to add jQuery code with AJAX call, similar to this:
1
@section('scripts')
2
<script type="text/javascript">
3
$("#country").change(function(){
4
$.ajax({
5
url: "{{ route('admin.cities.get_by_country') }}?country_id=" + $(this).val(),
6
method: 'GET',
7
success: function(data) {
8
$('#city').html(data.html);
9
}
10
});
11
});
12
</script>
13
@endsection
Copied!
Read more details in the article above.
Last modified 1yr ago
Copy link