Can you help me? I want to using AJAX to populate the data based on the selected value. but the following codes work well at FireFox, but not display the populated data IE7.0 . Some can help me to find the solutions?
For member register Action Country -> State -> City. At register.ctp file: I used the following code. ------------------------------------------------------------------------- <?php echo $form->input('Member/country', array('class' => 'required','label'=>'Country','onChange'=>'javascrip:getStateList(this.value)','type'=>'select','style'=>'width: 250px;', 'selected'=>'0', 'options'=> $this->requestAction('/Countries/ select') )); echo $form->input('Member/state', array('class' => 'required', 'type'=>'select','id'=>'MemberState', 'style'=>'width:250px;', 'onChange'=>'javascrip:getCityList(this.value)', 'options'=>array( '0' => 'Select one state/province')));?> ------------------------------------------------------------------------ <script> function getStateList(sel){ new Ajax.Updater('MemberState','/States/select/'+sel, {asynchronous:true, evalScripts:true}); } </script> At states_controller.php: -------------------------------------------------------------- function select($id = null){ $this -> RequestHandler -> setAjax($this); $id = $this->params['data']['form']['country']; if(!is_numeric($id)) $id = 2 ; $statelists = $this->State->generateList( " country_id = $id ", 'State.name ASC', null, '{n}.State.id', '{n}.State.name'); $this->set('statelists',$statelists); $this->render('select','ajax'); } ------------------------------------------------------------- At select.ctp: ----------------------------------------------------------------- <?php if (isset($statelists) && count($statelists)){ foreach($statelists as $key=>$name) { $results .= '<option value="'.$key.'">'.$name.'</option>'; } }else{ $results = '<option>Re-select a Country! </option>'; } echo $results; ?> ------------------------------------------------------------------- --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---