I am new in symfony2, I wanted to create a simple form and here is my code : in the controller :
public function testAction(Request $request) {
$form = $this->createFormBuilder()
->add('name','text')
->add('age','integer')
->add('save','submit')
->getForm()
;//initializing the form
return $this->render('LoginLoginBundle:Default:test.html.twig', array ('myform'=>$form->createView()));
}
}
in the twig file:
{%extends "::base.html.twig"%}
{% block body %}
{{ form(myform)}}
{% endblock %}
I get this error : Could not load type "submit" and even if I delete ->add('save','submit') I get this error :
The function "form" does not exist. Did you mean "form_row", "form_rest", "form_label", "form_errors", "form_widget", "form_enctype" in LoginLoginBundle:Default:test.html.twig at line 3