javascript - Dropdown box on change event for multiple list box -
my ($self, $c) = @_; $c->stash->{buildallinfo}=$c->model('db::misc')->gettestinformation();
buildall info dump :
apple => type2=>[2,3] type4=>[2,1] mango => type6=>[2,3] type2=>[2,1]
how render them in drop down box if drop down 1 chanes automatically drop down 2 should change?
= apple changes
it should automatically change have list of type2,4 thenn if thats selected should show 2,3
how achive this. not getting right solution this.
manipulation of content within drop-downs client-side function, , has handled javascript. catalyst , tt, work done when page rendered - manipulation beyond else's problem.
this means between model, catalyst , tt, arrangements have made data available javascript. in other words, line or 2 in template toolkit ensures whatever contents of stash need access javascript converted javascript variables.
typically, along these lines, jquery:
[% use json.escape %] <script> var buildallinfo = [% buildallinfo.json %]; // have js variable matches structure of perl stash variable $('#select_1').change(function(){ // adjust content of #select_2 using normal js techniques // $.grep(buildallinfo, ...) or whatever }); </script>
Comments
Post a Comment