CodeIgniter Forums
Refreshing a dropdown list when selecting another dropdown list. - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: Refreshing a dropdown list when selecting another dropdown list. (/showthread.php?tid=10906)

Pages: 1 2 3


Refreshing a dropdown list when selecting another dropdown list. - El Forum - 08-18-2008

[eluser]xwero[/eluser]
You can do a check in the javascript code to see what the url looks like maybe that is the problem.
Code:
var my_url = "index.php/state/"+src+"/"+val;
alert(my_url);
// ...
url: my_url,
// ...



Refreshing a dropdown list when selecting another dropdown list. - El Forum - 08-18-2008

[eluser]theighost[/eluser]
I AM GOING CRAZY the javascript is getting ignored or something....nothing appears but the HTML of the two empty dropdown lists!

not even an alert is not appearing!


Refreshing a dropdown list when selecting another dropdown list. - El Forum - 08-18-2008

[eluser]xwero[/eluser]
You build the states list using ajax?


Refreshing a dropdown list when selecting another dropdown list. - El Forum - 08-18-2008

[eluser]theighost[/eluser]
nope it uses php as u can see this script works on the localhost using normal php(not codeigniter)


Refreshing a dropdown list when selecting another dropdown list. - El Forum - 08-18-2008

[eluser]xwero[/eluser]
Then you have two problems as i get out of you responses:

1 : the states dropdown doesn't add the state options to the states dropdown (php problem)
2 : the change event of the dropdown doesn't get registered (javascript problem)

The first thing you have to do is to check where it goes wrong with the php code, this might be a solution to the ajax generated options problem too if you use similar code.
And then you need to check/code in javascript to registration of the change event.

Without more code i can't help you further. But if you do post code please wrap it in the bbcode tag code this make reading a bit easier as i'm used to the highlighting.


Refreshing a dropdown list when selecting another dropdown list. - El Forum - 08-18-2008

[eluser]theighost[/eluser]
i re arranged the javascript which wasnt colored(ignored) for some reason...now i see the alert as index.php/state/-1

it means it applies it.

now i built a function in the controller that is named state() this function loads a view which name is state.php

another function (which i apply in the url to test) is called state_dropdown() which loads the ajax script and has the connection not to the file state but to the function state that has the connection to the file state.

I hope u got me.

anyway the dropdown list remains empty!


Refreshing a dropdown list when selecting another dropdown list. - El Forum - 08-19-2008

[eluser]vendiddy[/eluser]
You might have to wrap that jquery script in a $(document).ready(function { ... });


Refreshing a dropdown list when selecting another dropdown list. - El Forum - 11-12-2009

[eluser]spmckee[/eluser]
Perhaps this will help: http://www.jgeppert.com/jquery-doubleselect/


Refreshing a dropdown list when selecting another dropdown list. - El Forum - 11-12-2009

[eluser]hugle[/eluser]
hi,

I have done something similar you are asking, using CI and jQuery,
you can take a look here:
http://demo3.invista.lt/search/page/1/loans/giving_and_requesting

If you liek it, I can share the code Smile


Refreshing a dropdown list when selecting another dropdown list. - El Forum - 11-12-2009

[eluser]spmckee[/eluser]
[quote author="hugle" date="1258065297"]hi,

I have done something similar you are asking, using CI and jQuery,
you can take a look here:
http://demo3.invista.lt/search/page/1/loans/giving_and_requesting

If you liek it, I can share the code Smile[/quote]

I'll bite. I've been trying to get something like that going and would love to see a working version.