I'm trying to customize form rendering in Symfony (). I manage to customize the "text" widget but fails to customize the "submit" widget. I am debugging this issue in many ways and I have come to the following (more simple) roadblock:
My controller is very standard and looks like this:
$ User = new users (); $ Form = $ this- & gt; CreateFormbuilder ($ user) - & gt; Add ('name', 'text') // other text items ... - & gt; Add ('Save', 'Submit', Array ('label' = & gt; 'signup')) $ form- & gt; HandleRequest ($ request); If ($ form-> valid)) {// presenting template ...}
Now, if I submit the form in the form in TWIG
{{form (form)}}
Everything works perfectly (the form is stored). But if I change it in:
{{form_widget (form)}}
"submit" button does not submit anything It seems that either the button does not trigger anything or my form will not be valid in any way).
Symphony documentation starts to tell that both of them should submit the form equally. Can someone give some guidance on where the problem is coming from? Finally, I get the same problem while trying to use {{form_widget (form.save)}} to customize the "submit" button.
Say "Best Practice: Add a button to a template, not in Form Class or Controllers." < / P>
No comments:
Post a Comment