sir, just follow up question.. is this the best way to approach dynamic dependent dropdown? specially on country state city situation? how bout the relationship type like each has its own table.. table country, table state, table city and connect them using relationships.. please i need ur opinion on this since im a newbie..
Hi, thanks for sharing this video, I want to see if you can help me, I have only two dropdowns for state and city. The values of the city dropdown are loaded correctly, but if there is some validation that is not fulfilled in the form, for example a field not captured, the city dropdown loses the elements that had been previously loaded. Thank you in advance if you could guide me
Hi Thanks for the tut. But for some reason, I can get it work. I'm getting error in the console: POST 127.0.0.1:8000/dynamic_dependent/fetch 500 (Internal Server Error) jquery.min.js:4. Any idea? I tried multiple projects with different machines with same result. I'm using WAMP Server.
public function dynamicDropdown() { $countrylist = DB::table('dynamicdropdown')->select('Country')->groupBy('Country')->get(); return view('dynamicdropdown')->with('countrylist', $countrylist); }
function fetch(Request $request) { $select = $request->get('select'); $value = $request->get('value'); $dependent = $request->get('dependent'); $data = DB::table('dynamicdropdown') ->where($select, $value) ->select($dependent) ->groupBy($dependent) ->get(); $output = 'Select '.ucfirst($dependent).''; foreach($data as $row) { $output .= ''.$row->$dependent.''; } echo $output; } Change like this and it will work, you have to use select method, i was getting this error today and fixed and killed my 2 hrs.
Hello groupBy('country') method is throwing this error "SQLSTATE[42000]: Syntax error or access violation: 1055 'testing.country_state_city.id' isn't in GROUP BY (SQL: select * from `country_state_city` group by `country`)" Any idea?
WHOEVER IS GETTING SERVER ERROR TRY TO IMPLEMENT LIKE BELOW, ALL YOU HAVE TO DO IS TO USE "SELECT" METHOD IN THE QUERY BUILDER FUNCTIONS public function dynamicDropdown() { $countrylist = DB::table('dynamicdropdown')->select('Country')->groupBy('Country')->get(); return view('dynamicdropdown')->with('countrylist', $countrylist); }
Arman i think the source code is correct check that 1. He didn't create controller as usual but it is only DynamicDependent.php 2. Be sure you write correctly in web.php Don't forget first one is GET method and second one is POST
i'm quite annoyed by the voice. but great stuff, thanks..
sir, just follow up question.. is this the best way to approach dynamic dependent dropdown? specially on country state city situation? how bout the relationship type like each has its own table.. table country, table state, table city and connect them using relationships.. please i need ur opinion on this since im a newbie..
how to use two tables using same method (dependent dropdown) country in one table and state in another table
is there any tutorial for getting selected dropdown value from the database using ajax in edit functionality?
This video is very good for one db table. But, if db table are multiple, then what can I do. Please reply me with a good suggestions.
Best Regards
just use country id to query in state and state id to query in city table everything is same
Thanks for your time and efforts it helped me a lot
Hi sir, Please make more video on laravel and ajax CRUD with full form elements includes input type file
thanks for the tutorial, please state data and city is not loading when the country option is selected from my end, it just remain blank, any help ?
This code work well on single value , but not working on multiple select value plz guide me
I want to change dropdown list colour scheme to blue to green. Is any way? can you please guide me?
This video is awesome..
Can you please tell me what is the use of _token variable in this video
This is for protection. This prevent the CSRF attack
what if we want to select multiple country then show their state together
sometimes you just need the concept ... I made that with Vue js. Thanks
Hi, thanks for sharing this video, I want to see if you can help me, I have only two dropdowns for state and city. The values of the city dropdown are loaded correctly, but if there is some validation that is not fulfilled in the form, for example a field not captured, the city dropdown loses the elements that had been previously loaded.
Thank you in advance if you could guide me
Please make more video on laravel and ajax
Hi Thanks for the tut. But for some reason, I can get it work. I'm getting error in the console: POST 127.0.0.1:8000/dynamic_dependent/fetch 500 (Internal Server Error) jquery.min.js:4. Any idea? I tried multiple projects with different machines with same result. I'm using WAMP Server.
have exactly the same issue. exept for: jquery.min.js:2
Did You solve this?
public function dynamicDropdown() {
$countrylist = DB::table('dynamicdropdown')->select('Country')->groupBy('Country')->get();
return view('dynamicdropdown')->with('countrylist', $countrylist);
}
function fetch(Request $request)
{
$select = $request->get('select');
$value = $request->get('value');
$dependent = $request->get('dependent');
$data = DB::table('dynamicdropdown')
->where($select, $value)
->select($dependent)
->groupBy($dependent)
->get();
$output = 'Select '.ucfirst($dependent).'';
foreach($data as $row)
{
$output .= ''.$row->$dependent.'';
}
echo $output;
}
Change like this and it will work, you have to use select method, i was getting this error today and fixed and killed my 2 hrs.
@@mysteriousmsn You are a life saver thanks so much
@@tinkerbell6834 You are Welcome.
thanks for that code 😁 but the voice irritates more more 😪its not clear ...
once again thanks for code
I follow this code but it cannot show data on dropdown dependent,any one help?
Thanks Weblesson for sharing knowledge
Hello groupBy('country') method is throwing this error "SQLSTATE[42000]: Syntax error or access violation: 1055 'testing.country_state_city.id' isn't in GROUP BY (SQL: select * from `country_state_city` group by `country`)" Any idea?
yes
WHOEVER IS GETTING SERVER ERROR TRY TO IMPLEMENT LIKE BELOW, ALL YOU HAVE TO DO IS TO USE "SELECT" METHOD IN THE QUERY BUILDER FUNCTIONS
public function dynamicDropdown() {
$countrylist = DB::table('dynamicdropdown')->select('Country')->groupBy('Country')->get();
return view('dynamicdropdown')->with('countrylist', $countrylist);
}
function fetch(Request $request)
{
$select = $request->get('select');
$value = $request->get('value');
$dependent = $request->get('dependent');
$data = DB::table('dynamicdropdown')
->where($select, $value)
->select($dependent)
->groupBy($dependent)
->get();
$output = 'Select '.ucfirst($dependent).'';
foreach($data as $row)
{
$output .= ''.$row->$dependent.'';
}
echo $output;
}
good! But all in one table...
Make video on laravel ajax filter using checkbox and start rating .
Laravel ajax comment system
How to submit this data from select boxes into new table of database??
ruclips.net/video/yIs_Y5adAYU/видео.html
Watch this.
thanks Webslesson, this help me alot.
source code can't download
please repair link
pdate config/database.php
set:
'mysql' => [
'strict' => false,
],
instead of:
'mysql' => [
'strict' => true,
],
after doing this, the error will disappeared
Best tutorial
groupby clause on Oracle having issues ORA-00979: not a GROUP BY expression.Did anyone have the same issue.Any help is much appreciated.
hey there , I am having the same problem have you fixed yours ????
wow what a great job.thank you very much
please make more tutorial we will be pleased
this source code link can't work can you help me pls
Arman i think the source code is correct check that
1. He didn't create controller as usual but it is only DynamicDependent.php
2. Be sure you write correctly in web.php Don't forget first one is GET method and second one is POST
I wanna see in vue.js. Nice. Tanks
it's very very very help me! I love you !
did this work for you ???
Great stuff my friend, thank you.
Hello Sir, Nice Video. lease Insert All These Dropdown Values In database Using Laravel . Make A Video Otherwise Add This With register Page.
the database structure isn't good not normalize and can cause a problem for the future use
thx, it's very help me! cool code!
Thank you very much sir
next try to put with a original voice ..
you are the web boss
Obrigado!!
You forgot to make ajax more secure in controller's action
if($request->ajax()){ //ajax code }
Awesome video, thanks for the lesson!
Thanks team weblesson
mantab slurrrr
very nice
great stuff
i like this
Why that voice ?
thanks
Nothing happened 🤤😢😥😭
hiiiiiiii
i hate the voice but great job
mali ang froeach
I wasted my time on something that doesn't work -.-