views:

389

answers:

2

I'm getting a 404 when trying to add a new module page. I'm apparently missing something fundamental here, being a newbie to Symfony. Can anyone point out what it is I'm missing?

Many thanks.


modules/admin/actions/actions.class.php

/* following executeIndex() */

public function executeSchedule()
{
    if ($this->getRequest()->getethod() != sfRequest::POST)
    {
        return sfView::SUCCESS;
    }
    else
    {
        $name = $this->getRequestParameter('first_name');
        echo $name;
    }
}

modules/admin/templates/scheduleSuccess.php

<?=set_title('Schedule')?>

<form action="/admin/schedule" method="POST">
<input name="foo" type="text">
<?php echo submit_tag('Schedule'); ?></p

Upon submit, I get this error:

Sep 28 10:02:37 symfony [info] {sfAction} call "defaultActions->executeError404()"
Sep 28 10:02:37 symfony [warning] {404} requested url: /admin/schedule
Sep 28 10:02:37 symfony [info] {sfView} initialize view for "default/error404"
+1  A: 
  1. Never hard code urls, use helpers like url_for.
  2. Use forms framework.
  3. Read tutorial: http://www.symfony-project.org/jobeet/1%5F2/Doctrine/en/
Kane
I was using form helpers and wondered if they were contributing to the issue. Shrug. form_tag('admin/schedule'), input_tag('foo'), etc. The echo was just to test some sort of output. Print_r wasn't working, either.As a side note, changing the form's method to GET works, strangely enough. That's been my fix for the moment...
J. LaRosee
+1  A: 

Also, don't echo in your actions. Use the setContent helper.

In your situation:

$name = $this->getRequestParameter('first_name');
$this->getResponse()->setContent($name);
Jestep