Country -> State combo box Ajax problem
Hi friends, As i have one form having Country and State combo box. Depend on country selected it will Fill up States automatically. Here is my Code : // file : edit.thtml //calling ajax functions function getstates(st) { country = $('country_name').value; alert(country); if(!country) $('mystatelist').innerHTML = 'Select'; else { url = root+'admin/users/update_select/?country='+country +'&state='+st; //alert(url); new Ajax.Request(url,{method:"get",onSuccess:function(transport){ $('mystatelist').innerHTML = ''+transport.responseText+''; //alert(transport.responseText); },onFailure:function(){alert('Failed to get states');}}); } } = Country and State Code : data); die; //$countries[0]='Select'; //pr($countries); die; foreach($countries as $key=>$value) { $countri[$value]=$value; } $carr=array(''=>'Select'); $countri = array_merge($countri,$carr); ksort($countri); $countrybill=$this->data['User']['Country']; // $selected = mystate; ?> selectTag('User/country_name', $countri , $countrybill, array('id'=>'country_name','onchange'=>'getstates()'), array(), false);?> State/Province Select === Now please tell me what is the problem ?? Country is filled up from database table countries but after selecting country STATE combo is not filled up. Please solve my problem --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Country -> State combo box Ajax problem
Hi friends, As i have one form having Country and State combo box. Depend on country selected it will Fill up States automatically. Here is my Code : // file : edit.thtml //calling ajax functions function getstates(st) { country = $('country_name').value; alert(country); if(!country) $('mystatelist').innerHTML = 'Select'; else { url = root+'admin/users/update_select/?country='+country +'&state='+st; //alert(url); new Ajax.Request(url,{method:"get",onSuccess:function(transport){ $('mystatelist').innerHTML = ''+transport.responseText+''; //alert(transport.responseText); },onFailure:function(){alert('Failed to get states');}}); } } = Country and State Code : data); die; //$countries[0]='Select'; //pr($countries); die; foreach($countries as $key=>$value) { $countri[$value]=$value; } $carr=array(''=>'Select'); $countri = array_merge($countri,$carr); ksort($countri); $countrybill=$this->data['User']['Country']; // $selected = mystate; ?> selectTag('User/country_name', $countri , $countrybill, array('id'=>'country_name','onchange'=>'getstates()'), array(), false);?> State/Province Select === Now please tell me what is the problem ?? Country is filled up from database table countries but after selecting country STATE combo is not filled up. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---