Hi everyone,

I know this topic has been discussed a million times, but I have a
weird problem with saving a HABTM relation. The premise is as follows:

I have a model "Event", which is setup with a HABTM relationship with
the model "Ticketseller". Now I let Bake create all the necessary
controllers and views. The event/add.ctp view for example is as
follows:

<div class="events form">
<?php echo $form->create('Event');?>
        <fieldset>
                <legend><?php __('Add Event');?></legend>
        <?php
                echo $form->input('date');
                echo $form->input('doors_open');
                echo $form->input('start');
                echo $form->input('category_id');
                echo $form->input('pricevvk');
                echo $form->input('priceak');
                echo $form->input('headline');
                echo $form->input('Ticketseller');
        ?>
        </fieldset>
<?php echo $form->end('Submit');?>
</div>

and then the usual actions beneath. When I click on "Add Event" in my
browser, the Ticketseller is represented by a <select> list (each
Ticketseller as an option), with the ability to select multiple
entries at once. However, when I fill out the form and select one or
two Ticketsellers and then click on "Add", I get to a blank page that
just shows the SQL debug output in the upper left corner, which solely
lists some describe statements. I tried putting some output in the add
function of the controller, which gets rendered, when I open the form,
but doesn't, once I try saving it.
When I comment out the line "echo $form->input('Ticketseller');" or
substitute it by:

if(is_array($tickets)){
  echo '<div class="input"><label for="TicketTicket">Ticket</
label><select name="data[Ticket][Ticket][]" multiple="multiple"
id="TicketTicket">';
  foreach($tickets as $ticket => $title) {
        echo "<option value='{$ticket}' name='data[Ticket][Ticket][]'>" .
$title . "</option>";
  }
  echo '</select></div>';
}

everything works fine. So I guess it's some bug in the FormHelper???
Does anybody know how to resolve this??


Regards,

Sebastian
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to