Page 1 of 1

search form error: regions/cities appear/disappear

PostPosted: 20 Jan 2014, 11:30
by support
if you select a country, the Region options can't be found. Just until you select a Property type. When you select that - the regions appear.
Then, the city still cannot be selected until you select/change Property type again.
If you change Region - the cities disappear again, just until you change Property type (again).


You can do the following:
In the protected/modules/apartments/views/backend/__form_general.php file
instead of
 
Code: Select all
array('id'=>'ap_country',
                 'ajax' => array(
                 'type'=>'POST', //request type     

write
 
Code: Select all
array('id'=>'ap_country',
                 'ajax' => array(
                    'type'=>'GET', //request type      


instead of
Code: Select all
array('id'=>'ap_region',
                 'ajax' => array(
                 'type'=>'POST', //request type     

write
Code: Select all
array('id'=>'ap_region',
                 'ajax' => array(
                    'type'=>'GET', //request type     
 

in the protected/modules/location/controllers/MainController.php file
instead of
     
Code: Select all
public function actionGetCities() {
        $region = Yii::app()->request->getPost('region', 0);
        $type = Yii::app()->request->getPost('type', 0); 

write
     
Code: Select all
public function actionGetCities() {
        $region = Yii::app()->request->getQuery('region', 0);
        $type = Yii::app()->request->getQuery('type', 0); 



instead of
    
Code: Select all
 public function actionGetRegions() {
        $country = Yii::app()->request->getPost('country', 0);
        $type = Yii::app()->request->getPost('type', 0);
        $all = Yii::app()->request->getPost('all', 0); 

write
     
Code: Select all
public function actionGetRegions() {
        $country = Yii::app()->request->getQuery('country', 0);
        $type = Yii::app()->request->getQuery('type', 0);
        $all = Yii::app()->request->getQuery('all', 0); 


In the
protected/modules/location/views/backend/city/_form.php file
instead of
                 
Code: Select all
array('id'=>'ap_country',
                     'ajax' => array(
                        'type'=>'POST', //request type     

write
                
Code: Select all
 array('id'=>'ap_country',
                     'ajax' => array(
                        'type'=>'GET', //request type      



In the protected/views/site/_search_field_location.php file
instead of
            
Code: Select all
 array('class' => $fieldClass . ' searchField', 'id' => 'country',
                 'ajax' => array(
                    'type'=>'POST', //request type     

write
             
Code: Select all
array('class' => $fieldClass . ' searchField', 'id' => 'country',
                 'ajax' => array(
                    'type'=>'GET', //request type      

Re: search form error: regions/cities appear/disappear

PostPosted: 20 Jan 2014, 12:07
by jeffer
You forgot this in protected/views/site/_search_field_location.php

Code: Select all
array('class' => $fieldClass ' searchField''id' => 'region',
                
'ajax' => array(
                    
'type'=>'GET'//request type 


Was POST as well ...