Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have a HTML form written in plain HTML (i.e. not using a createFormBuilder object) and I want my controller to handle the submission of that form in the same way that it would if I had created it using createFormBuilder.

My form's path is the same as the @route for the method in the controller, but I can't find an alternative to

$form->handleRequest($request);
if ($form->isSubmitted() ) {
}

Should I just do it the symfony way?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
140 views
Welcome To Ask or Share your Answers For Others

1 Answer

Try it

patch is a your controller name and the action name

 <form class="formSearch" action="{{ path('patch') }}" method="POST">
     <input class="inputSearch" type="text" name="issn">


     <div class="">
         <button class="buttonSerch2" type="submit">serach</button>
     </div>
 </form>

 /**
 * @Route("/main/patch",name="patch")
 */
public function patchAction(Request $request)
{
if ($request->getMethod() == Request::METHOD_POST) {
$Issn =trim($request->get('issn'));


}
 }

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...