Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6533241
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:06:05+00:00 2026-05-25T10:06:05+00:00

I am building (well trying to) a contact form for a project I’m working

  • 0

I am building (well trying to) a contact form for a project I’m working on. I have been following this “tutorial” here and at first I changed bits of the tutorial to fit my project. So, in my Contactform.php file (which is what the Task.php file is in the tutorial) my code looks like this:

namespace Shout\MainBundle\Entity;

class Contactform
{
protected $yourname;

protected $youremail;

protected $yourphone;

protected $yourenquiry; 

protected $newsletter;

protected $events;

public function getYourname()
{
    return $this->yourname;
}
public function setYourname($yourname)
{
    $this->yourname = $yourname;
}

public function getYouremail()
{
    return $this->youremail;
}
public function setYouremail($youremail)
{
    $this->youremail = $youremail;
}

public function getYourphone()
{
    return $this->yourphone;
}
public function setYourphone($yourphone)
{
    $this->yourphone = $yourphone;
}

public function getYourenquiry()
{
    return $this->yourenquiry;
}
public function setYourenquiry($yourenquiry)
{
    $this->YourEnquiry = $yourenquiry;
}

public function getNewsletter()
{
    return $this->newsletter;
}
public function setNewsletter($newsletter)
{
    $this->newsletter = $newsletter;
}

public function getEvents()
{
    return $this->events;
}
public function setEvents($events)
{
    $this->events = $events;
}

In the DefaultClasses.php file (where I’m handling the contact form rendering) I have the following code:

    public function contactAction(Request $request)
{

    $contactform = new Contactform();

    $form = $this->createFormBuilder($contactform)
        ->add('yourname', 'text')
        ->add('youremail', 'text')
        ->add('yourphone', 'text')
        ->add('yourenquiry', 'text')
        ->add('newsletter', 'text')
        ->add('events', 'text')
        ->getForm();

    return $this->render('ShoutMainBundle:Default:contact.html.twig', array('form' => $form->createView()));

}

Obviously this is different to the tutorial as I don’t want to pre-populate it with data.

Then, in the contact.php.twig file, I have the following code calling the contact form:

                    <form action="{{ path('form_contact') }}" method="post" {{ form_enctype(cform) }}>
                    {{ form_widget(cform) }}

                    <input type="submit" />
                </form>

However, I keep getting the following error:

An exception has been thrown during the rendering of a template (“Route “form_contact” does not exist.”) in “ShoutMainBundle:Default:contact.html.twig” at line 62.

The reason I have been referring to the tutorial is that, thinking I have made a mistake in editing the original code, I copy and pasted all of the code that’s on the tutorial in to my project. But I still receive this error.

I spent the last part of Friday on this and the best part of this morning on it but I’m still hitting this brick wall. Is there something I’ve missed or am I going the wrong way about it?

Edit:
Here is the routing file:

    ShoutMainBundle_mainpage:
    pattern:  /mainpage/{slug}
    defaults: { _controller: ShoutMainBundle:Default:mainpage }
ShoutMainBundle_subpage:
    pattern:  /mainpage/{page}/{slug}
    defaults: { _controller: ShoutMainBundle:Default:subpage }
ShoutMainBundle_news:
    pattern:  /news
    defaults: { _controller: ShoutMainBundle:News:index }
ShoutMainBundle_newsarticle:
    pattern:  /news/article/{article}
    defaults: { _controller: ShoutMainBundle:News:article }
ShoutMainBundle_event:
    pattern:  /event
    defaults: { _controller: ShoutMainBundle:Event:index }
ShoutMainBundle_eventselected:
    pattern:  /event/{id}/{event}
    defaults: { _controller: ShoutMainBundle:Event:selected }
ShoutMainBundle_blog:
    pattern:  /blog
    defaults: { _controller: ShoutMainBundle:Blog:index }
ShoutMainBundle_blogarticle:
    pattern:  /blog/article/{article}
    defaults: { _controller: ShoutMainBundle:Blog:article }
ShoutMainBundle_blogcategorieshome:
    pattern:  /blog/categories/
    defaults: { _controller: ShoutMainBundle:Blog:categoryhome }
ShoutMainBundle_blogcategoriesselected:
    pattern:  /blog/category/{category}
    defaults: { _controller: ShoutMainBundle:Blog:categoryselected }
ShoutMainBundle_blogarchive:
    pattern:  /blog/archive/{category}
    defaults: { _controller: ShoutMainBundle:Blog:archive }
ShoutMainBundle_contact:
    pattern:  /contact-us
    defaults: { _controller: ShoutMainBundle:Default:contact }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T10:06:05+00:00Added an answer on May 25, 2026 at 10:06 am

    The issue was that the “action” part was trying to find a page that wasn’t there. I removed that and it worked. Will now create a page for it to reference.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the CTE below working well in re-cursing an employee table and building
I am trying to make a form building tool. Everything was working just fine.
I am building a form in Zend Framework 1.9 using subforms as well as
Building my first SL MVVM application (Silverlight4 RC) and have some issues i don't
we're building a scheduler system and have a couple of situations where we're trying
I am trying to convert my model-first project to code-first, as I can see
I am trying to expose a single well defined class by building a static
I have been trying to figure out the best practices to write test-friendly code,
I'm building my first iPhone app and I'm stymied. I'm trying to build an
I'm building (well, trying to build) a simple usenet news reader. The code below

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.