Hi all together, i have a problem and i don´t know how i can solve this. in a form i have a select box. when i select one of this values, ajax will get the requested data over the "data_interface.ctp" the values are vissible and clickable. But i can´t save the checkboxed values...
Here´s my code edit.ctp $select_value = array <http://www.php.net/array>(); $select_value[null] = '-- Keine Auswahl --'; foreach($places as $place) { $key = $place['Place']['id']; $value = $place['Place']['stadt']; $select_value[$key] = $value; } $mydata = $this->data; if ( $mydata['Event']['place_id'] != null ) { foreach ( $select_value as $k => $v ) { if ( $mydata['Event']['place_id'] == $k ) { $this_is_selected = $k; } } } else { $this_is_selected = 0; } echo $this->Js->Form->select('place_id', $select_value); echo $this->Js->writeBuffer(); echo $this->Html->div(null, '', array <http://www.php.net/array>('id' => 'target-div')); ?> ... <script typ="text/javascript"> $("#EventPlaceId").click(function(){ var selectedValue = $("#EventPlaceId").val(); $.get("/events/data_interface/"+ selectedValue, function(data) { $('#target-div').fadeOut("fast", function() { $('#target-div').html(data); $('#target-div').fadeIn("fast"); }); }); return false; }); </script> data_interface.ctp $select_value = array <http://www.php.net/array>(); foreach($locations as $location) { $key = $location['Location']['id']; $value = $location['Location']['name']; $select_value[$key] = $value; } echo $this->Form->select('location_id', $select_value, array<http://www.php.net/array> ('label'=> false, 'multiple' => 'checkbox')); EventsController.php public $helpers = array <http://www.php.net/array>('Js' => array<http://www.php.net/array> ('Jquery')); public $components = array <http://www.php.net/array>('RequestHandler'); ... public function data_interface($place_id) { $locations = $this->Event->Location->findAllByPlaceId($place_id); $this->set('locations', $locations); } When i click on the "Save" button, cake stores all data without "location_id" to the events table. But how can I teach cake to store the values, which are set for " location_id" ? Any ideas ? Nice Greetings and thanks for help -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php
