Hi folks,
I have 2 models in my database, Event and EventType. EventType is
very simple, it's just an id and a name - so I don't want to write a
whole controller for it. In my Event controller, I have this method:
<?php EventsController extends AppController
{
$uses = array('Event', 'EventType');
function admin_addtype()
{
$this->set('exiting_types', $this->EventType->findAll());
if(isset($this->data))
{
$this->EventType->create();
if($this->EventType->save($this->data))
{
$this->Session->setFlash('Event Type Added');
}
}
}
}
?>
However, in my view, I have this:
<div id="event">
<?php e($form->create('EventType',
array('action'=>'/admin/event/addtype')));?>
<fieldset id="event-add">
<legend>Add a new event type</legend>
<?php e($form->input('name'));?>
</fieldset>
<?php e($form->submit('Submit Event Type'));?> <?php
e($html->link('Cancel', '/admin/events/index',
array('class'=>'button-link')));?>
<?php e($form->end());?>
</div>
<div id="existing-types">
<ul>
<?php foreach ($exiting_types as $et) : ?>
<li><?php e($et['EventType']['name']);?></li>
<?php endforeach;?>
</ul>
</div>
The problem I am having is that when I try and submit the new event
type, the URL that the form goes to is
/admin/event_types/admin/event/addtype/.
Is there any way to overide this, so it doesn't default to adding the
/admin/event_types on the front of the URL??
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---