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();
$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('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
EventsController.php
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
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
No comments:
Post a Comment